Archived

This topic is now archived and is closed to further replies.

dta1

GL_ARB_vertex_blend

Recommended Posts

I can''t figure out how you''re supposed to use the GL_ARB_vertex_blend extension. I''ve read about it in the opengl extension register and came up with this code:

	glMatrixMode(GL_MODELVIEW1_ARB);
	glLoadIdentity();

	glMatrixMode(GL_MODELVIEW0_ARB);
	glLoadIdentity();

// Render other stuff...


	// Bind the texture

	glBindTexture(GL_TEXTURE_2D, texture);

	glEnable(GL_VERTEX_BLEND_ARB);

	glVertexBlendARB(2);

	float j[2] = { 0.5f, 0.5f };
	glWeightfvARB(2, j);

	glMatrixMode(GL_MODELVIEW1_ARB);

	// Draw triangles

	glBegin(GL_TRIANGLES);

	// Go through all vertices

	for(int i=0; i<m_numVertices; i++)
	{
		glTexCoord2f(m_texCoords[i].x, m_texCoords[i].y); 
		glNormal3fv	(m_normals	[i + frame * m_numVertices].data());
		glVertex3fv	(m_vertices	[i + frame * m_numVertices].data());
	}

	frame++;

	glMatrixMode(GL_MODELVIEW0_ARB);

	// Draw triangles

	glBegin(GL_TRIANGLES);

	// Go through all vertices

	for(i=0; i<m_numVertices; i++)
	{
		glTexCoord2f(m_texCoords[i].x, m_texCoords[i].y); 
		glNormal3fv	(m_normals	[i + (frame+1) * m_numVertices].data());
		glVertex3fv	(m_vertices	[i + (frame+1) * m_numVertices].data());
	}

	glEnd();

	glDisable(GL_VERTEX_BLEND_ARB);

// Render other stuff...


That''s the way I thought it was meant to be but it just renders the same model twice (on the same spot) but with different frames. I would appreciate a hint in the right direction

Share this post


Link to post
Share on other sites