mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-14 05:06:54 +03:00
Some work on the OpenGL 3 renderer.
This commit is contained in:
@@ -26,27 +26,30 @@ void cVertexBufferOGL::Draw() {
|
||||
if( mElemDraw < 0 )
|
||||
lSize = GetIndexCount();
|
||||
|
||||
glDrawElements( mDrawType, lSize, GL_UNSIGNED_INT, &mIndexArray[0] );
|
||||
GLi->DrawElements( mDrawType, lSize, GL_UNSIGNED_INT, &mIndexArray[0] );
|
||||
} else {
|
||||
glDrawArrays( mDrawType, 0, GetVertexCount() );
|
||||
GLi->DrawArrays( mDrawType, 0, GetVertexCount() );
|
||||
}
|
||||
}
|
||||
|
||||
void cVertexBufferOGL::SetVertexStates() {
|
||||
Uint32 alloc = GetVertexCount() * sizeof(GLfloat) * 2;
|
||||
Uint32 allocC = GetVertexCount() * sizeof(GLfloat) * 4;
|
||||
|
||||
/// POSITION
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_POSITION ) ) {
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glVertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0] );
|
||||
GLi->EnableClientState( GL_VERTEX_ARRAY );
|
||||
GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0], alloc );
|
||||
} else {
|
||||
//glDisableClientState( GL_VERTEX_ARRAY );
|
||||
//GLi->DisableClientState( GL_VERTEX_ARRAY );
|
||||
}
|
||||
|
||||
/// COLOR
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_COLOR ) ) {
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
glColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, sizeof(Uint8) * eeVertexElements[ VERTEX_FLAG_COLOR ], &mColorArray[0] );
|
||||
GLi->EnableClientState( GL_COLOR_ARRAY );
|
||||
GLi->ColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, sizeof(Uint8) * eeVertexElements[ VERTEX_FLAG_COLOR ], &mColorArray[0], allocC );
|
||||
} else {
|
||||
//glDisableClientState( GL_COLOR_ARRAY );
|
||||
//GLi->DisableClientState( GL_COLOR_ARRAY );
|
||||
}
|
||||
|
||||
/// TEXTURES
|
||||
@@ -54,25 +57,25 @@ void cVertexBufferOGL::SetVertexStates() {
|
||||
for ( Int32 i = 0; i < 5; i++ ) {
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_TEXTURE0 + i ) ) {
|
||||
glClientActiveTextureARB( GL_TEXTURE0_ARB + i );
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
glTexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0] );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0], alloc );
|
||||
} else {
|
||||
//glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
//GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_TEXTURE0 ) ) {
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glTexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0] );
|
||||
GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0], alloc );
|
||||
} else {
|
||||
//glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
//GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTextureARB( GL_TEXTURE0_ARB );
|
||||
GLi->ActiveTexture( GL_TEXTURE0_ARB );
|
||||
glClientActiveTextureARB( GL_TEXTURE0_ARB );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user