How do I display non-power-of-2 textures using OpenIL/DevIL?
Before I switched to OpenIL/DevIL I used GL_TEXTURE_RECTANGLE_ARB. How do I do this with OpenIL/DevIL?
Thanks,
Braden
I've never used OpenIL or DevIL, but I don't see how they could possibly make it so that you can't use an OpenGL extension. You should be able to use it the same way as always.
Calexus,
The reference page for gluBuild2DMipmaps() says that the target must be GL_TEXTURE_2D. GL_TEXTURE_2D doesn't let you use non-power-of-2 textures. I am going to try to put something else other then GL_TEXTURE_2D there to see if it works (even though it says not to (as an experiment)). Are there any other functions that would do it?
http://www.mevis.de/~uwe/opengl/gluBuild2DMipmaps.html
Kalidor,
I might be reading this documentation wrong, but I believe it takes an image loaded by the OpenIL/DevIL library and stores it in an opengl texture format returning a pointer to the texture.
http://openil.sourceforge.net/docs/ilut/f00171.htm
Thanks,
Braden
The reference page for gluBuild2DMipmaps() says that the target must be GL_TEXTURE_2D. GL_TEXTURE_2D doesn't let you use non-power-of-2 textures. I am going to try to put something else other then GL_TEXTURE_2D there to see if it works (even though it says not to (as an experiment)). Are there any other functions that would do it?
http://www.mevis.de/~uwe/opengl/gluBuild2DMipmaps.html
Kalidor,
I might be reading this documentation wrong, but I believe it takes an image loaded by the OpenIL/DevIL library and stores it in an opengl texture format returning a pointer to the texture.
http://openil.sourceforge.net/docs/ilut/f00171.htm
Thanks,
Braden
Returns a pointer to the texture in VRAM or AGP memory? No. Returns a pointer to the texture in RAM? Most likely.
gluBuild2DMipmaps() builds (surprise!) mipmaps. GL_TEXTURE_RECTANGLE_ARB Doesn't support mipmaps.
gluBuild2DMipmaps() builds (surprise!) mipmaps. GL_TEXTURE_RECTANGLE_ARB Doesn't support mipmaps.
vNistelrooy,
I never stated which memory it was. I had intended it to mean RAM, which means you just restated what I said on all accounts.
Braden
I never stated which memory it was. I had intended it to mean RAM, which means you just restated what I said on all accounts.
Braden
The texture doesn't display on the screen.
Braden
/* texid is of type GLuint */glEnable(GL_TEXTURE_RECTANGLE_ARB); ilBindImage(flat_textures[1]); texid=ilutGLBindTexImage(); glBindTexture(GL_TEXTURE_RECTANGLE_ARB,texid); glBegin(GL_QUADS); { glTexCoord2f(0,768); glVertex2f(0,0); glTexCoord2f(0,0); glVertex2f(0,768); glTexCoord2f(1024,0); glVertex2f(1024,768); glTexCoord2f(1024,768); glVertex2f(1024,0); } glEnd(); glDeleteTextures(1,&texid); glDisable(GL_TEXTURE_RECTANGLE_ARB);
From the DevIL tutorial on using it with OpenGL:
What this means is that DevIL is resizing your texture and then binding it to a TEXTURE_2D target. If you want to use TEXTURE_RECTANGLE, you will have to manually upload the texture.
Quote:DevIL allows the use of arbitrarily-sized images, but OpenGL only works with images that have dimensions that are powers of 2, for optimization purposes. If an image has dimensions that are not powers of 2, DevIL will resize the image before sending it to OpenGL.
What this means is that DevIL is resizing your texture and then binding it to a TEXTURE_2D target. If you want to use TEXTURE_RECTANGLE, you will have to manually upload the texture.
Oh, I didn't know that. I changed the extension to GL_TEXTURE_2D and something loads, but its not the image. Its garble. Im trying to think what might cause that.
Braden
Braden
If you have only changed TEXTURE_RECTANGLE to TEXTURE_2D in that code snippet above, I can understand - the texture coordinates are way too large, making the texture tile like crazy. That may look like garbage.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement