Help

Im taking a opengl course and I am looking a good link on how to use Nvidia’s VAR extension with vertices having texture coordinates. So far I have stored my vertices in a buffer but I dont know how to store the texture coordinates in the buffer, I would really appreaciate any help, thanks.

Just put them after the vertex position.
Instead of:

var=SwglAllocateMemory(sizeof(float)3numVert);

use:

var=SwglAllocateMemory(sizeof(float)*(3+2)*numVert);

how would you point to them since they are in the same array as the pointer, i am used to

glTexCoordPointer( 2, GL_FLOAT, 0, texcoordarray );

how would i point it to the vertices in the VAR buffer, and would I store the vertices and their corresponding texture coordinates or would I seperate them in two groups, thanks for the help.

Strange question. You’d use it the same way you’re using standard vertex arrays. VAR just gives you a pointer in video memory for you to fill with vertices, nothing more. It’s up to you to decide how you’ll break up the memory in vertices.

Y.

If your vertex format is

struct Vertex {
float x, y, z;
float s, t;
};

Then the “stride” value of calls to VertexPointer and TexCoordPointer should be sizeof(Vertex), not 0.