//When i create the Texture...
glGenTextures(1,&textureid);
glBindTexture(GL_TEXTURE_2D,textureid);
glTexImage2D(GL_TEXTURE_2D,mips,GL_RGBA,width_p2,height_p2,0,GL_RGBA,GL_UNSIGNED_BYTE,buffer);
//When i create the UV buffer
glGenBuffersARB(1,&bufferid);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,bufferid);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,size*sizeof(ldmath::Vector2),buffer,GL_STATIC_DRAW_ARB);
//When i set the texture
//(When not power of 2 is not supported _p2
//is not a power of 2 and the buffer reflects the same
glActiveTextureARB(GL_TEXTURE0_ARB + channel);
glBindTexture(GL_TEXTURE_2D,textureid);
glEnable(GL_TEXTURE_2D);
//When i set my UV buffer...
//channel is from [0-n]
glClientActiveTextureARB(GL_TEXTURE0_ARB + channel);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,bufferid);
glTexCoordPointer(2,GL_FLOAT, 0, BUFFER_OFFSET(offset));
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
Multi Texture with VBO
I'm having a problem with my VBO objects that have multi textures. When I was using 1 texture everything seemed to work. Since my geometry is displaying i will ommit the vertex and color code since this all works.
So basically I have it isolated to either my UV buffers or Texture stuff. I am really new to the whole multi texture thing. Also without multi-texture my textures did display.
I think that's it... Then it all comes down to the same draw call.
I edited the code so there may be syntax error, but i assure you it compiles... what I really need to understand is how to use multi-texture exstension.
Any help would be greatly appreciated!
[Edited by - Matsy on March 15, 2005 11:47:10 AM]
You're not enabling the texture on the client side.
after glClientActiveTexture() you need a glEnable(GL_TEXTURE_2D) call.
EDIT: try this, this is how i did it and it works.
first enable all of your TexCoord arrays using glClientActiveTexture().
*then*
enable all texture units on the server side using glActiveTextureARB.
then draw.
after glClientActiveTexture() you need a glEnable(GL_TEXTURE_2D) call.
EDIT: try this, this is how i did it and it works.
first enable all of your TexCoord arrays using glClientActiveTexture().
*then*
enable all texture units on the server side using glActiveTextureARB.
then draw.
Hi
This is how my multi text works with vbos:
//first texture
glActiveTextureExt(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tiles[tileno].tex);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindBufferARB( GL_ARRAY_BUFFER_ARB , vboTextureData );
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Activate the second texture ID
glActiveTextureExt(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tiles[tileno].tex2);
// Here we turn on the COMBINE properties and increase our RGB
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glBindBufferARB( GL_ARRAY_BUFFER_ARB , vboTextureData );
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
....
....
glDrawElements(...)
--------------------------------------------------------
cheers hope this helps
Ade
This is how my multi text works with vbos:
//first texture
glActiveTextureExt(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tiles[tileno].tex);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindBufferARB( GL_ARRAY_BUFFER_ARB , vboTextureData );
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Activate the second texture ID
glActiveTextureExt(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tiles[tileno].tex2);
// Here we turn on the COMBINE properties and increase our RGB
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glBindBufferARB( GL_ARRAY_BUFFER_ARB , vboTextureData );
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
....
....
glDrawElements(...)
--------------------------------------------------------
cheers hope this helps
Ade
Thanks for all the replies... I got it working. It turned out to be when I set my Min filter and Mag filter everything worked. I was un aware that there was no default value. I have lots to learn with GL. But I'm seing the textures now finally.
But here another strange problem that only happens in window mode. My cursor is a 16x32 bitmap. And when I move it around the screen (using matrix transforms). The left side of the bitmap seems to bleed over to the right, and it may be happening the other way around too. But I do not any pixels on the right side to verify at this time.
But here another strange problem that only happens in window mode. My cursor is a 16x32 bitmap. And when I move it around the screen (using matrix transforms). The left side of the bitmap seems to bleed over to the right, and it may be happening the other way around too. But I do not any pixels on the right side to verify at this time.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement