Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SFML::DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect rect, float u1, float v1, float u2, float v2 )
- {
- #if SFML_VERSION_MAJOR == 2
- const sf::Texture* tex = static_cast<sf::Texture*>( pTexture->data );
- #else
- const sf::Image* tex = static_cast<sf::Image*>( pTexture->data );
- #endif
- if ( !tex )
- return DrawMissingImage( rect );
- Translate( rect );
- tex->Bind();
- glColor4f(1, 1, 1, 1 );
- glBegin( GL_QUADS );
- glTexCoord2f( u1, v1 ); glVertex2f(rect.x, rect.y);
- glTexCoord2f( u1, v2 ); glVertex2f(rect.x, rect.y + rect.h);
- glTexCoord2f( u2, v2 ); glVertex2f(rect.x + rect.w, rect.y + rect.h);
- glTexCoord2f( u2, v1 ); glVertex2f(rect.x + rect.w, rect.y) ;
- glEnd();
- glBindTexture( GL_TEXTURE_2D, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement