PDA

View Full Version : Linear interpolation between VBOs



resle
05-31-2010, 01:09 PM
First time poster to the OpenGL boards, old time OpenGL coder back home after some DX years :)

So... I've just learned how to work with VBOs but there's something I can't still figure out: how to send two distinct VBOs (same vertex count) to the shader and further interpolate between the two to get the final position (with interpolation as another float variable ranging from 0 to 1 that must be passed to the vertex program as well)

Any hints?
Thanks in advance,

andrea

Dark Photon
05-31-2010, 03:55 PM
I can't still figure out: how to send two distinct VBOs (same vertex count) to the shader



glBindBuffer( GL_ARRAY_BUFFER, vbo1 );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 0, 0 );
glBindBuffer( GL_ARRAY_BUFFER, vbo2 );
glVertexAttribPointer( 1, 3, GL_FLOAT, GL_FALSE, 0, 0 );
glEnableVertexAttribArray( 0 );
glEnableVertexAttribArray( 1 );

Alfonse Reinheart
05-31-2010, 07:24 PM
Any hints?

This (http://www.opengl.org/wiki/Vertex_Specification) ought to be just about everything you need to know about how to send vertex data to OpenGL. And if it's not there, it's probably linked from there.

BionicBytes
06-01-2010, 04:39 AM
Your interpolation will need to be sent as a uniform parameter to the vertex shader.