for(int x = 0; x < 20; ++x)
{
for(int y = 0; y < 20; ++y)
{
glPushMatrix();
glLoadIdentity();
glTranslatef( (float) x * 32.0f, (float) y * 32.0f, 0.0f);
Just plugged what you showed into simple glut framework app. No problems. You must be doing something else in your app to cause your problem.
Do the tiles start at the lower left corner, up against the window edge and then go beyond the upper and right sides or is there a gap between the lower and left edges and the start of your tiles? Are you using gluLookAt somewhere in your code, thereby moving the eye from 0.0, 0.0, 0.0? Are you using glScale? Gotta be something else, because the code you showed works properly.
I fixed it by setting the viewport before initializing opengl, the pixelformat stuff.
Im using my own win32 opengl wrapper, maybe it was the problem.
I don’t know why though.
Im not using gluLookat, glscale or anything like that.
[This message has been edited by -Tony- (edited 04-28-2003).]
Calling any gl command before creating and making current a valid context is the same as not calling it at all. Are you sure your window is actually 640 by 640 and not something else? But, the viewport defaults to the size of the window when the context is created so it isn’t usually necessary. Anyway, you got it working… all that matters.