void FBO::DeactivateDepthTexture() { DeactivateTexture(); }
void RenderGPUGeometry( struct GPUGeometry * g ) { struct VertexData ** vd = g->vertexdatas; char ** names = g->names; int NumVertexSets = g->vertexcount; struct IndexData * id = g->indices; int i; int tcarrayset = 0; int normalarrayset = 0; int colorarrayset = 0; //Can't render. if( !vd[0] ) return; if( !(vd[0]->vbo) ) return; for( i = 0; i < MAX_TEXTURES; i++ ) { if( g->textures[i] ) { ActivateTexture( g->textures[i] ); } } for( i = 1; i < NumVertexSets; ++i ) { const char * name = names[i]; if( !vd[i] ) continue; if( !vd[i]->vbo ) continue; glBindBufferARB( GL_ARRAY_BUFFER_ARB, vd[i]->vbo ); if( strcmp( name, "texture" ) == 0 ) { glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glTexCoordPointer( vd[i]->stride, GL_FLOAT, 0, 0 ); tcarrayset = 1; } else if( strcmp( name, "color" ) == 0 ) { glEnableClientState( GL_COLOR_ARRAY ); glColorPointer( vd[i]->stride, GL_FLOAT, 0, 0 ); colorarrayset = 1; } else if( strcmp( name, "normal" ) == 0 ) { glEnableClientState( GL_NORMAL_ARRAY ); glNormalPointer( GL_FLOAT, vd[i]->stride*4, 0 ); normalarrayset = 1; } else if( CurrentShader ) { int iTexPosID = glGetAttribLocationARB( CurrentShader->program, name ); glEnableVertexAttribArrayARB( iTexPosID ); glVertexAttribPointerARB( iTexPosID, vd[i]->stride, GL_FLOAT, 0, 0, 0 ); } } glBindBufferARB( GL_ARRAY_BUFFER_ARB, vd[0]->vbo ); glVertexPointer( vd[0]->stride, GL_FLOAT, 0, 0 ); #ifdef USE_IBO glEnableClientState( GL_VERTEX_ARRAY ); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id->ido); glDrawElements(GL_TRIANGLES, id->indexcount, GL_UNSIGNED_INT, 0); glDisableClientState( GL_VERTEX_ARRAY ); #else glEnableClientState( GL_VERTEX_ARRAY ); glDrawElements( g->mode, id->indexcount, GL_UNSIGNED_INT, id->indexdata ); glDisableClientState( GL_VERTEX_ARRAY ); #endif if( tcarrayset ) { glDisableClientState( GL_TEXTURE_COORD_ARRAY ); } if( colorarrayset ) { glDisableClientState( GL_COLOR_ARRAY ); } if( normalarrayset ) { glDisableClientState( GL_NORMAL_ARRAY ); } for( i = 0; i < MAX_TEXTURES; i++ ) { if( g->textures[i] ) { DeactivateTexture( g->textures[i] ); } } }