
textures and picture size
Hi,
I have a question about texturing.
I know i have to use pictures that have height and width like 64x64(power of 2).When i need other pictures i use Photoshop to adjust the size.My question is if there is a way i can adjust the size of any picture automatically from my code.When i choose a texture with size 65X65 for example the program should adjust it to 64X64.The program should be able to understand the size of the chosen picture and adjust it to the lower acceptable size.(I am not talking about mipmaps where the size does not matter but simple texturing using the code:
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data)
Thanks!

quote:
Original post by grfxer
I am not talking about mipmaps where the size does not matter but simple texturing using the code...
Mipmaps also have to be power of two. gluBuild2DMipmaps will resize the image to a power of two if needed, but that doesn''t mean mipmaps can be of non-power of two dimensions.
Anyways, you need to scale the image if it''s not a power of two. Either code your own function, use gluScaleImage, or use some third party image library/code. Search google, there''s alot of it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement