Sign in to follow this  
DracoLacertae

reuse same VBO data offsets for multiple texture coordinates

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:

[code]

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!
[/code]

[color="#1C2837"][size="2"]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?[/size][/color]

[color="#1C2837"][size="2"]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?[/size][/color]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this