glNewList(blocks[blockNum].blockList, GL_COMPILE);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(0.0f, 0.0f, -0.1f);
// Polygon points in OpenGL work counter-clockwise, so we need to go backwards through the points
glBegin(GL_POLYGON);
for (index = blocks[blockNum].numPoints - 1; index >= 0; --index)
{
glTexCoord2f(blocks[blockNum].texCoords[index].x, blocks[blockNum].texCoords[index].y);
glVertex2i(blocks[blockNum].points[index].x, blocks[blockNum].points[index].y);
}
glEnd();
glPopMatrix();
glEndList();
The block coordinates are (clockwise):
0,100
180,100
300,160 <- This point seems to be raised slightly
560,160
560,200
280,200
160,140
0,140
It looks like the vertex is raised by around 5-10 pixels.
Any help would be appreciated
Polygon problem
I''m writing a basic 2D platformer made up of blocks and entities. Blocks are similiar to the brushes in Q3 maps, but of course are just simple 2D. I''m drawing each block as a single polygon, and compiling that to a display list.
However, I seem to have a problem with a single polygon. One of the vertices seems to have risen when it shouldn''t. I changed to GL_LINES to see if it was the level loading code, but the lines rendered perfectly.
The code I''m using to compile the list:
Polygons rendered with the GL_POLYGON mode should be convex or they won''t display properly.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement