I don’t seem to understand how texturing works for VBOs. It was easy back then when I used immediate mode (glTexCoord2f …) but you can of course not apply the same to VBOs.
I do know that you need to create own buffers / add the texture coordinates to a buffer but I can not really figure out how these coordinates actually work / look like. When I used immediate mode it was a little bit like this:
glBindTexture( ... );
glTexCoord2f(1f,0);
glVertex2d(x + 50, y);
// ...
I guess that I can also use TEXTURE_2D in this case.
This is what I got in my vertex buffer (just the normal buffer which contains the coordinates of my quad):
-0.5f,-0.5f, 0f, 0.5f,-0.5f,0f, 0.5f,0.5f,0f, -0.5f,0.5f,0f
(Yes, the quads are visible so there shouldn’t be any problem)
My questions now are:
[o] How would the texture coordinates for this quad look like(This all happens in 3D - space)?
[o] At which place do I have to call glBindTexture( … )?
I do know that you need following piece of code to enable texture coordinates:
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboTextureHandle);
glTexCoordPointer(3, GL_FLOAT, 0, 0);
Thanks in advance.
Note:
I have used the search function but I couldn’t find anything that helped me out.