williajl40

01-20-2015, 07:14 AM

Hello All,

I am relatively new to the OpenGL graphics programming and I hope that someone can give me some assistance or shed some light on the problem I am having with rendering a polygon face.

I have a polygon made up of 12 vertices. The overall shape of the polygon is a representation of the letter H with specific parameters as follows:

- Height

- Width

- WallThickness1599

These parameters should be self explanatory. I create 12 normalized vertices from the above information and I start a GL_POLYGON operation with the 12 vertices in clockwise order. This is a closed polygon. What happens is that I get something that is not rendered correctly as expected. See attached imagine. Additionally, to ensure that my vertices are in fact correct, I also perform a GL_LINE_LOOP with the same 12 vertices. They draw as expected for the given shape. See code below.

glLoadIdentity();

glTranslatef(FLocation.X,FLocation.Y,FLocation.Z);

// glRotatef(FAngle,Rotx,Roty,Rotz);

glColor3f(FNormSurfColor1.Red,FNormSurfColor1.Gree n,

FNormSurfColor1.Blue);

glBegin(GL_POLYGON);

for(LIndex=0;LIndex<12;LIndex++)

glVertex3f(FBackFace[LIndex].X,

FBackFace[LIndex].Y,

FBackFace[LIndex].Z);

glEnd();

glLoadIdentity();

glTranslatef(FLocation.X,FLocation.Y,FLocation.Z);

//glRotatef(FAngle,Rotx,Roty,Rotz);

//First render the backface wireframe

glBegin(GL_LINE_LOOP);

glColor3f(FNormWireFrameColor.Red,FNormWireFrameCo lor.Green,

FNormWireFrameColor.Blue);

for(LIndex=0;LIndex<12;LIndex++)

glVertex3f(FBackFace[LIndex].X,

FBackFace[LIndex].Y,

FBackFace[LIndex].Z);

glEnd();

Is there a particular reason for the way this object is rendering on the screen, and how can I fix this?

Thanks,

James

I am relatively new to the OpenGL graphics programming and I hope that someone can give me some assistance or shed some light on the problem I am having with rendering a polygon face.

I have a polygon made up of 12 vertices. The overall shape of the polygon is a representation of the letter H with specific parameters as follows:

- Height

- Width

- WallThickness1599

These parameters should be self explanatory. I create 12 normalized vertices from the above information and I start a GL_POLYGON operation with the 12 vertices in clockwise order. This is a closed polygon. What happens is that I get something that is not rendered correctly as expected. See attached imagine. Additionally, to ensure that my vertices are in fact correct, I also perform a GL_LINE_LOOP with the same 12 vertices. They draw as expected for the given shape. See code below.

glLoadIdentity();

glTranslatef(FLocation.X,FLocation.Y,FLocation.Z);

// glRotatef(FAngle,Rotx,Roty,Rotz);

glColor3f(FNormSurfColor1.Red,FNormSurfColor1.Gree n,

FNormSurfColor1.Blue);

glBegin(GL_POLYGON);

for(LIndex=0;LIndex<12;LIndex++)

glVertex3f(FBackFace[LIndex].X,

FBackFace[LIndex].Y,

FBackFace[LIndex].Z);

glEnd();

glLoadIdentity();

glTranslatef(FLocation.X,FLocation.Y,FLocation.Z);

//glRotatef(FAngle,Rotx,Roty,Rotz);

//First render the backface wireframe

glBegin(GL_LINE_LOOP);

glColor3f(FNormWireFrameColor.Red,FNormWireFrameCo lor.Green,

FNormWireFrameColor.Blue);

for(LIndex=0;LIndex<12;LIndex++)

glVertex3f(FBackFace[LIndex].X,

FBackFace[LIndex].Y,

FBackFace[LIndex].Z);

glEnd();

Is there a particular reason for the way this object is rendering on the screen, and how can I fix this?

Thanks,

James