Advertisement
snake5

direct3d9 vs opengl

Jul 12th, 2013
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1. #ifdef USED3D
  2.     IDirect3DDevice9_SetTexture( GD3DDev, 0, T ? T->obj : NULL );
  3.     IDirect3DDevice9_SetVertexDeclaration( GD3DDev, F->vdecl );
  4.     IDirect3DDevice9_DrawPrimitiveUP( GD3DDev, type,
  5.         getprimitivecount( type, count / F->size ),
  6.         data, F->size );
  7.     IDirect3DDevice9_SetVertexDeclaration( GD3DDev, NULL );
  8.  
  9. #else
  10.     if( F->P[0] ) glVertexPointer( F->P[3], F->P[2], F->size, data + F->P[1] );
  11.     if( F->T[0] ) glTexCoordPointer( F->T[3], F->T[2], F->size, data + F->T[1] );
  12.     if( F->C[0] ) glColorPointer( F->C[3], F->C[2], F->size, data + F->C[1] );
  13.     if( F->N[0] ) glNormalPointer( F->N[2], F->size, data + F->N[1] );
  14.    
  15.     if( T )
  16.     {
  17.         glBindTexture( GL_TEXTURE_2D, T->id );
  18.         glEnable( GL_TEXTURE_2D );
  19.     }
  20.     else
  21.         glDisable( GL_TEXTURE_2D );
  22.    
  23.     if( F->P[0] ) glEnableClientState( GL_VERTEX_ARRAY );
  24.     if( F->T[0] ) glEnableClientState( GL_TEXTURE_COORD_ARRAY );
  25.     if( F->C[0] ) glEnableClientState( GL_COLOR_ARRAY );
  26.     if( F->N[0] ) glEnableClientState( GL_NORMAL_ARRAY );
  27.    
  28.     glColor4f( 1, 1, 1, 1 );
  29.     if( idcs )
  30.         glDrawElements( type, count, GL_UNSIGNED_SHORT, idcs + start * 2 );
  31.     else
  32.         glDrawArrays( type, start, count );
  33.    
  34.     if( F->P[0] ) glDisableClientState( GL_VERTEX_ARRAY );
  35.     if( F->T[0] ) glDisableClientState( GL_TEXTURE_COORD_ARRAY );
  36.     if( F->C[0] ) glDisableClientState( GL_COLOR_ARRAY );
  37.     if( F->N[0] ) glDisableClientState( GL_NORMAL_ARRAY );
  38.    
  39. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement