PDA

View Full Version : Texture changes on resize of window



10-15-2002, 03:36 AM
Hi, This is a bizzare problem and I can't seem to figure out why my rendering is doing this. Keep in mind I am new to OGL so this may have a simple solution.

I have a .tga image mapped on a quad, rendering is fine until I resize the window or change monitor resolutions the texture will get its RGB values randomly scaled on the whole image incorrectly. So sometimes the image is too green, or may not not enough blue, or sometimes uniformly be to dark. Strange...

Besides that all my points, trianges and colors on them appear fine, its just my texture mapping.

FYI, this is compiled and running on the Mac OS 8.6.

Any clues of why this color change?

Thanks in advance!

nexusone
10-15-2002, 05:05 AM
What is your view port and ortho/perspective settings?



Originally posted by Veldren:
Hi, This is a bizzare problem and I can't seem to figure out why my rendering is doing this. Keep in mind I am new to OGL so this may have a simple solution.

I have a .tga image mapped on a quad, rendering is fine until I resize the window or change monitor resolutions the texture will get its RGB values randomly scaled on the whole image incorrectly. So sometimes the image is too green, or may not not enough blue, or sometimes uniformly be to dark. Strange...

Besides that all my points, trianges and colors on them appear fine, its just my texture mapping.

FYI, this is compiled and running on the Mac OS 8.6.

Any clues of why this color change?

Thanks in advance!

10-16-2002, 03:11 AM
Here is my window resize procedure.

OSStatus ReshapeGL (GLsizei width, GLsizei height)
{
global_width = width;
global_height = height;

glViewport(0, 0, width, height);

// matrix of camera
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

// set camera
gluPerspective(60., (float)width/(float)height, 0.01, 100.);

// the model view matrix is replaced
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// the list of characters is erased
glDeleteLists(bitmapBase, 1);

// recreate it according to the new data
bitmapBase = (GLint)glGenLists(256);
aglUseFont(aglGetCurrentContext(), kPlatformDefaultGuiFontID, normal, 10, 0, 256, bitmapBase);

return noErr;
}