PDA

View Full Version : Help



msotojr
04-10-2003, 02:40 PM
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.

KRONOS
04-10-2003, 03:06 PM
Just put them after the vertex position.
Instead of:



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


use:




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

msotojr
04-11-2003, 04:41 AM
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.

Ysaneya
04-11-2003, 05:10 AM
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.

jwatte
04-11-2003, 08:36 AM
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.