PDA

View Full Version : Draw 3D pictures



11-15-2003, 03:31 PM
Hello
I am using MFC with openGL to simulate plane wing 3D movement.
I used code below to draw a 3D model of plane wing. But nothing show on the screen. What's wrong wiht these code? Is there any materail saying how to create 3D geometry ?

void showWing()
{
glClear(...);
glLoadIdentity();
glTranslatef(-0.5f, 0.0f, 0.0f);

glBegin(GL_QUAD_STRIP);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-2.0f, 0.4f, 1.0f);
glVertex3f(-2.0f, 0.4f, -1.0f);
glVertex3f(2.0f, 0.4f, 0.5f);
glVertex3f(2.0f, 0.4f, -0.5f);
glColor3f(1.0f, 1.0f, 0.0f);
glVertex3f(2.2f, 0.4f, 1.10f);
...

glEnd();
SwapBuffers(hDC->GetSafeHdc());
}

Thanks in advance

jason

mikael_aronsson
11-16-2003, 05:41 AM
Hi !

You only translate the "camera" along the X axis not along the Z axis (which you are looking down by default), so you might in a place where you don't see the quads. You also has to check your clipping planes so they are correct.

Make sure you have placed the verices in the correct order for the quads to show up.

Mikael