Menne
06-18-2002, 01:52 AM
I'm using OpenGL for a 2D game which supports maps up to 3200x2400 pixels. Now I wanted to create a overview bitmap of each map. I tryed it this way:
int w = pMap->GetWidth();
int h = pMap->GetHeight();
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, w, h, 0, 0.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
pMap->Draw(); //Draw map
// Read the pixels into mem
mem = new BYTE [w * h * 3];
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, mem);
It's working but it just draw the area onto the bitmap which fits in the window. So if the window is 640x480 pixels only the botttom left of the map is drawn the rest is a dull gray. I think that OpenGL is clipping against the window (dc) boundarys, so is it possible to disable this clipping?
Sincerely,
Michael Menne
int w = pMap->GetWidth();
int h = pMap->GetHeight();
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, w, h, 0, 0.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
pMap->Draw(); //Draw map
// Read the pixels into mem
mem = new BYTE [w * h * 3];
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, mem);
It's working but it just draw the area onto the bitmap which fits in the window. So if the window is 640x480 pixels only the botttom left of the map is drawn the rest is a dull gray. I think that OpenGL is clipping against the window (dc) boundarys, so is it possible to disable this clipping?
Sincerely,
Michael Menne