Bonesteel

05-11-2010, 08:16 PM

Hi, I'm working on a project where I need to draw a profile of a solid then extrude it and show it in 3d. Currently I start out using glOrtho2d then after I draw my profile I'm switching to glOrtho to show it in 3d. It this the correct way to do it? I can't get anything to show up in my window and I'm not sure why.

I start out with this:

glMatrixMode(GL_PROJECTION); // three lines to be explained later

glLoadIdentity();

gluOrtho2D(0.0, (GLdouble)screenWidth, 0.0, (GLdouble)screenHeight);

Then after I draw my profile I do this:

glShadeModel(GL_SMOOTH); // Set type of shading

glEnable(GL_DEPTH_TEST); // Determine depth for visibility

glEnable(GL_NORMALIZE); // Correct reflection angles

glViewport(0, 0, 640, 640);

// Set up the GL_PROJECTION matrix

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glOrtho(-320, 320, -320, 320, 0.0, 6400);

// Set up the GL_MODELVIEW matrix

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

gluLookAt(2400, -2400, 2400, 0, 0, 0, 0.0, 0.0, 0.0);

Thanks for the help.

I start out with this:

glMatrixMode(GL_PROJECTION); // three lines to be explained later

glLoadIdentity();

gluOrtho2D(0.0, (GLdouble)screenWidth, 0.0, (GLdouble)screenHeight);

Then after I draw my profile I do this:

glShadeModel(GL_SMOOTH); // Set type of shading

glEnable(GL_DEPTH_TEST); // Determine depth for visibility

glEnable(GL_NORMALIZE); // Correct reflection angles

glViewport(0, 0, 640, 640);

// Set up the GL_PROJECTION matrix

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glOrtho(-320, 320, -320, 320, 0.0, 6400);

// Set up the GL_MODELVIEW matrix

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

gluLookAt(2400, -2400, 2400, 0, 0, 0, 0.0, 0.0, 0.0);

Thanks for the help.