View Full Version : Nonsquare texturemaps?
10-07-2004, 06:39 PM
I was wondering if it is possible to use a texture map that is not a power of 2. I have several images of arbitrary size which need to be placed on individual rectangles. I would prefer not to have to doctor the image to be a power of 2 compatible image. If it is possible I would sure appreciate some sample code of how to do it because I am not finding anything on the internet.
10-07-2004, 09:21 PM
Well, unfortunately you will need to set both width and height to powers of 2 for OpenGL ES. However, width and height do not have to be identical, so textures can be rectangular.
10-08-2004, 12:38 PM
Furthermore, just because the texture file dimensions need to be powers of two, doesn't mean you need to use all that space.
i.e. You could fill a 256 x 256 texture with some 167x233 image, and just be sure to plot your texture vertices appropriately.
Of course, if you want to use texture wrapping, then forget what I just said altogether.
10-18-2005, 10:22 AM
Is it the only way to fill the colorbuffer with texture ?
In the case of a barground image,
Copying a texture to a larger buffer, will eat time and memory,
how comes there is no way to directly copy an image to the colorbuffer ?
04-23-2012, 02:43 AM
@clintsinger: For NPOT texturing you have to set some specific filtering modes i.e.:
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.