View Full Version : Problems using texture objects

04-13-2001, 10:20 AM

I just started fooling around with texure mapping yesterday following the directions in the Superbible, and I had no problem implementing a function to read in .bmp's, define them as the current texture, and then drawing a texture mapped object.

However when I attempted to use texture objects so as not to have to constantly redefine the current texture I can't get the textures to work.

I know that my .bmp loading and texture object generating functions work because I plopped them into the example code given with the superbible and it still worked, which means that I am properly generating a texture object.

If that's the case then all I should have to do is call

glBindTexture(GL_TEXTURE_2D, texture[0]);

and then render away, but it's not working.

I don't create my texture objects until after window creation so I have on clue why they won't work rendering for me but they will in Micheal Sweet's code.

thanks in advance for all your help,

04-13-2001, 03:48 PM
Maybe this can help clarify things, this is how I create the texture object in my init():

metalTexture = textureLoad("metal07.bmp", 0, GL_REPEAT, GL_REPEAT, GL_LINEAR);

textureLoad is very similar to the function on page 283 of the SuperBible.

this is my rendering function:

/* Clear the color and depth buffers */

glBindTexture(GL_TEXTURE_2D, metalTexture);

if(glIsTexture(metalTexture) )
printf("Is a texture object\n");
printf("Isn't a texture\n");

.....Some calls to render objects

The glIsTexture() returns true, so it is a texture object, so what am I missing in the rendering setup?


04-13-2001, 04:31 PM
Okay guys sorry, I'm a dum--s:

I needed to use:

metalTexture = textureLoad("metal07.bmp", 0, GL_LINEAR, GL_LINEAR, GL_REPEAT);

and I was using:

metalTexture = textureLoad("metal07.bmp", 0, GL_REPEAT, GL_REPEAT, GL_LINEAR);

So my function was attempting to set MIN/MAG_FILTERs of GL_REAPEAT, and a wrap of GL_LINEAR. I guess that the error had already been cleared by the time I tried to use glGetError();

thanks to everyone who read this,