Stuart McDonald

02-26-2008, 03:21 PM

Hi,

I have some 3D data that is a set of triangles on the XZ plane all at a fixed height and I want to draw them using gluOrtho2D.

The following test code which has a triangle on the XZ plane at a fixed depth (-500) works. It draws a triangle touching the bottom corners and the middle of the top edge

glMatrixMode (GL_PROJECTION);

glLoadIdentity ();

gluOrtho2D(0, 400, 0, 400);

glMatrixMode (GL_MODELVIEW);

glLoadIdentity ();

gluLookAt (0, -500, 0,

0.0, 0.0, 0.0,

0.0, 0.0, 1.0);

GLfloat white[] = { 1.0,1.0,1.0 };

glColor3fv(white);

glBegin(GL_TRIANGLES);

glVertex3d(0, -500, 0);

glVertex3d(400,-500, 0);

glVertex3d(200,-500,400);

glEnd();

However, if I make the triangle Y = 500 instead of -500 I can't get the triangle to appear. I assumed the -500 in gluLookAt would be 500 (and maybe change the sign of the UP vector), but I've tried lots of parameter combinations (FYI GL_CULL_FACE is disabled).

I'm missing something obvious, but I can't see it.

Thanks,

Stuart.

I have some 3D data that is a set of triangles on the XZ plane all at a fixed height and I want to draw them using gluOrtho2D.

The following test code which has a triangle on the XZ plane at a fixed depth (-500) works. It draws a triangle touching the bottom corners and the middle of the top edge

glMatrixMode (GL_PROJECTION);

glLoadIdentity ();

gluOrtho2D(0, 400, 0, 400);

glMatrixMode (GL_MODELVIEW);

glLoadIdentity ();

gluLookAt (0, -500, 0,

0.0, 0.0, 0.0,

0.0, 0.0, 1.0);

GLfloat white[] = { 1.0,1.0,1.0 };

glColor3fv(white);

glBegin(GL_TRIANGLES);

glVertex3d(0, -500, 0);

glVertex3d(400,-500, 0);

glVertex3d(200,-500,400);

glEnd();

However, if I make the triangle Y = 500 instead of -500 I can't get the triangle to appear. I assumed the -500 in gluLookAt would be 500 (and maybe change the sign of the UP vector), but I've tried lots of parameter combinations (FYI GL_CULL_FACE is disabled).

I'm missing something obvious, but I can't see it.

Thanks,

Stuart.