|
From: <axl...@us...> - 2008-12-30 14:53:55
|
Revision: 94
http://hgengine.svn.sourceforge.net/hgengine/?rev=94&view=rev
Author: axlecrusher
Date: 2008-12-30 14:53:52 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
fix multitextures with VBOs
Modified Paths:
--------------
Mercury2/src/MercuryVBO.cpp
Modified: Mercury2/src/MercuryVBO.cpp
===================================================================
--- Mercury2/src/MercuryVBO.cpp 2008-12-30 14:52:16 UTC (rev 93)
+++ Mercury2/src/MercuryVBO.cpp 2008-12-30 14:53:52 UTC (rev 94)
@@ -23,7 +23,7 @@
void MercuryVBO::Render(MercuryNode* node)
{
-// unsigned short numTextures = Texture::NumberActiveTextures();
+ unsigned short numTextures = Texture::NumberActiveTextures();
unsigned short stride = sizeof(float)*8;
if ( m_initiated )
@@ -40,8 +40,13 @@
if ( this != m_lastVBOrendered)
glVertexPointer(3, GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*5));
- //XXX This seems to apply texture coordinates to all active texture units
- glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*0));
+ //apply all the active textures
+ for (uint8_t i = 0; i < numTextures; ++i)
+ {
+ glActiveTexture( GL_TEXTURE0+i );
+ glClientActiveTextureARB(GL_TEXTURE0+i);
+ glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*0));
+ }
glDrawRangeElements(GL_TRIANGLES, 0, m_indexData.Length()-1, m_indexData.Length(), GL_UNSIGNED_SHORT, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|