//glutSolidSphere(1.0, 20, 16);
//glRotatef(30.0f,0.0f,1.0f,1.0f);
GeometryTransfer();
//SetLightPos();
glColor3f(0.0f, 1.0f, 0.0f);
if(0) {
Normal(parabolicSurf[a][r], parabolicSurf[a][r + 1],
for(int a = 0; a < 36; a++) {
for(int r = 0; r < 9; r++) {
double n[3];
glBegin(GL_QUADS);
parabolicSurf[(a + 1)6][r + 1], n);
glNormal3dv(n);
glEnd();
glVertex3dv(parabolicSurf[a][r]); glVertex3dv(parabolicSurf[a][r + 1]);
glVertex3dv(parabolicSurf[(a + 1)6][r + 1]); glVertex3dv(parabolicSurf[(a + 1)6][r]);
}
}
}
DrawTextureGraph();
glFlush (); }
void reshape (int w, int h) {
glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity();
m_clientWidth = w; //add by cxg m_clientHeight = h; //
if (w <= h)
glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); else
glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
void mouse(int button, int state, int x, int y) {
switch (button) {
case GLUT_LEFT_BUTTON: if (state == GLUT_DOWN) {
diffuseMaterial[0] += 0.1; if (diffuseMaterial[0] > 1.0) diffuseMaterial[0] = 0.0; glColor4fv(diffuseMaterial);
m_downPoint.x=x; //add by cxg m_downPoint.y=y; // m_leftDown=1; //
}
else // { }
Point3I curPoint; curPoint.x=x; curPoint.y=y;
ProcessMoving(curPoint);
glutPostRedisplay(); break;
case GLUT_MIDDLE_BUTTON: if (state == GLUT_DOWN) { diffuseMaterial[1] += 0.1; if (diffuseMaterial[1] > 1.0) diffuseMaterial[1] = 0.0; glColor4fv(diffuseMaterial); glutPostRedisplay(); } break;
case GLUT_RIGHT_BUTTON: if (state == GLUT_DOWN) {
//m_transMode = (m_transMode + 1)%3; //add by cxg flag = (flag + 1)%3;
diffuseMaterial[2] += 0.1; if (diffuseMaterial[2] > 1.0) diffuseMaterial[2] = 0.0; glColor4fv(diffuseMaterial); glutPostRedisplay(); } break; default: break; } }
void keyboard(unsigned char key, int x, int y) {
switch (key) { case 27: exit(0); break; } }