SFML community forums

Help => Graphics => Topic started by: Grimshaw on February 21, 2011, 01:26:49 am

Title: Explanation on SFML textures
Post by: Grimshaw on February 21, 2011, 01:26:49 am
I've ran into this problem:

I have a regular sprite, to which i changed alpha with SetColor()

I have some other drawing code which binds another texture in opengl, which screws up the sfml rendering of the sprite.

To prevent this, i used glGet to save the current texture before the custom drawing code. And restored that texture with glBindTexture after it.

This worked, and both drawing code and sfml are rendering correctly, except the texture has full alpha again( color 255,255,255,255 ).

What happened to my custom color, and how to restore it?
Title: Explanation on SFML textures
Post by: Laurent on February 21, 2011, 07:51:18 am
You should rather use the dedicated SFML functions:
- PreserveOpenGLStates (1.6)
- SaveGLStates / RestoreGLStates (2.0)
Title: Explanation on SFML textures
Post by: Grimshaw on February 21, 2011, 03:48:23 pm
Okay, i will only be calling that once per frame, but still, i don't win performance with my way? : )
Title: Explanation on SFML textures
Post by: Laurent on February 21, 2011, 04:15:04 pm
You do, but it's probably not worth the effort.