• Advertisement
Sign in to follow this  

reuse same VBO data offsets for multiple texture coordinates

This topic is 2391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Often when enabling multiple textures, I'm using the same texture coordinates for each texture; just because I use the same UV mapping for all the maps a particular model needs. When I'm in that particular case, is it acceptable to do this:



struct vertex
{
float x,y,z; //pos
float s,t; //texcorod
float nx, ny, nz; //norm
};


...

glClientActiveTexture (GL_TEXTURE0_ARB);
glTexCoordPointer (2, GL_FLOAT, sizeof (vertex), offsetof(vertex, s) );
glClientActiveTexture (GL_TEXTURE1_ARB);
glTexCoordPointer (2, GL_FLOAT, sizeof (vertex), offsetof(vertex, s) ); //same data again!


[color="#1C2837"]The reason I ask, is because it seems a little unusual. Usually, each float in the vertex goes to one place: GL position from x,y,z, normal from nx, ny, nz, but now it's sending s and t to two places: texcoord0 and texcoord1. Is there any downside to doing this?

[color="#1C2837"]I know when using all user-specified attributes (GL 3+) you can just send in ONE texcoord and feed it into both samplers. When using built-in attributes, it is allowed to pull two attributes from the same place?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement