   VBO: Vertex structure & interpolation
  Hi, I am returning to OpenGL (3.0) after having abandoned it since version 1.1 so I am a bit disoriented with what's deprecated and what isn't, and how to correctly deal with shaders (I have been working with DX10 until today).Problem #1: Building a VBO the right way.My vertex is quite typical. x,y,z,nx,ny,nz,u,v - nothing special.I suppose I should something like this... but please correct me if I am wrong:glBindBuffer(GL_ARRAY_BUFFER, vboID);glVertexAttribPointer(0, nVerts, GL_FLOAT, false, SizeOf(tvertex), 0);glVertexAttribPointer(1, nVerts, GL_FLOAT, false, SizeOf(tvertex), 0);glVertexAttribPointer(2, nVerts, GL_FLOAT, false, SizeOf(tvertex), 0);glBufferData(GL_ARRAY_BUFFER,nVerts * sizeof(tvertex), @data, GL_STATIC_DRAW);What then? I am puzzled about how will I access to the data in the shader, I still have to understand the semantics...Problem #2: Linear interpolation in the vertex shaderEach mesh I have, will be made by several separate VBOs each one representing an animation frame. In DX10 I used to "push" two separate vertex buffers into the vertex shader, and once into the shader code itself I just had to Lerp(V1, V2) and out the result.Can you hint me on how to do the same in OpenGL/GLSL?Thanks in advance,   andrea   
Quote:I suppose I should something like this... but please correct me if I am wrong:What you've posted there is close to the code you would use to draw a vbo, but you still have to set it up.First in your shader you'll have some variables like in vec3 vertex; //variable names can be anythingin vec3 normal;in vec2 texcoord0;Then after building the shader, you query the shader to find the attribute locations for your variablesint vertexAttribLocation = glGetAttribLocation(shaderHandle,"vertex");int normalAttribLocation = glGetAttribLocation(shaderHandle,"normal");int texcoord0AttribLocation = glGetAttribLocation(shaderHandle,"texcoord0");Then when you want to draw the vbo:glVertexAttribPointer(vertexAttribLocation , nVerts, GL_FLOAT, false, SizeOf(tvertex), 0);glVertexAttribPointer(normalAttribLocation , nVerts, GL_FLOAT, false, SizeOf(tvertex), 3*sizeof(float));glVertexAttribPointer(texcoord0AttribLocation , nVerts, GL_FLOAT, false, SizeOf(tvertex), 6*sizeof(float));This sends x,y,z to "vertex", nx,ny,nz to "normal", etc. (my offset code might not be right, I don't typically use interleaved buffers)Regarding your two seperate buffers, you can do this by just defining two sets of inputs:in vec3 vertexA;in vec3 vertexB;in vec3 normalA;in vec3 normalB;And then mix them in the shader as you want.;  Thank you very much. Help me understand something more if you can.When I create a VBO (I.e., reading vertex data from disk, let's say), I will do the following:glGenBuffers(1, @vboID);glBindBuffer(GL_ARRAY_BUFFER, vboID);glBufferData(GL_ARRAY_BUFFER,nverts * sizeof(tvertex), @data, GL_STATIC_DRAW);This is done once, and does nothing more than loading a stream of data into memory.Then, every time I want to render that data using a given shader, I will:glBindBuffer(GL_ARRAY_BUFFER, vboID);HERE I DO WHAT YOU EXPLAINED (getattriblocation, attribpointer etc.) glDrawArrays(GL_TRIANGLES, etc. etc.)Is this correct?;  You only have to do glGetAttribLocation once if you store the integer. I wouldn't call that every frame because when you query the gpu I think it has to flush, so just do it when the shader is built and store the integer.You have to change the attribpointer every time you draw a new object, so you'll do that multiple times per frame.Also there is no requirement that when calling draw all of your pointers have to be into the same buffer. Once you set the pointer you can change the buffer.Your per frame draw could be something like this:glBindBuffer(arbitraryBuffer0)glVertexAttribPointer(...some pointers...)glBindBuffer(arbitraryBuffer1)glVertexAttribPointer(...some other pointers...)glBindBuffer(0)glDrawArrays() (takes attributes from buffer0 and buffer1)This site is a pretty good intro to glsl if you have any more questions.   