Advertisement
Guest User

Untitled

a guest
Jan 5th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. void SFML::DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect rect, float u1, float v1, float u2, float v2 )
  2. {
  3. #if SFML_VERSION_MAJOR == 2
  4. const sf::Texture* tex = static_cast<sf::Texture*>( pTexture->data );
  5. #else
  6. const sf::Image* tex = static_cast<sf::Image*>( pTexture->data );
  7. #endif
  8.  
  9. if ( !tex )
  10. return DrawMissingImage( rect );
  11.  
  12. Translate( rect );
  13.  
  14. tex->Bind();
  15.  
  16. glColor4f(1, 1, 1, 1 );
  17.  
  18. glBegin( GL_QUADS );
  19. glTexCoord2f( u1, v1 ); glVertex2f(rect.x, rect.y);
  20. glTexCoord2f( u1, v2 ); glVertex2f(rect.x, rect.y + rect.h);
  21. glTexCoord2f( u2, v2 ); glVertex2f(rect.x + rect.w, rect.y + rect.h);
  22. glTexCoord2f( u2, v1 ); glVertex2f(rect.x + rect.w, rect.y) ;
  23. glEnd();
  24.  
  25. glBindTexture( GL_TEXTURE_2D, 0);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement