SFML community forums

Help => Graphics => Topic started by: Tank on March 25, 2011, 08:40:48 am

Title: glCullFace makes SFML blind
Post by: Tank on March 25, 2011, 08:40:48 am
Hi guys,

it just happened to me that when enabling GL_CULL_FACE (with GL_BACK), SFML won't display its stuff anymore.

A workaround is to disable culling around the SFML rendering, however I'm just wondering if that should happen in SFML itself. Of course it means another call every cycle, I don't know how high the impact is.

Greetings.
Title: glCullFace makes SFML blind
Post by: Laurent on March 25, 2011, 08:57:52 am
There are many OpenGL states that can mess up SFML rendering, so I chose to not set explicitely those that have a correct default value, to avoid unnecessary overhead.

If you start using OpenGL on top of SFML, use the dedicated functions to save and restore OpenGL states.
Title: glCullFace makes SFML blind
Post by: Tank on March 25, 2011, 10:52:56 am
Alright, just what I thought. I'll keep in manual then to avoid saving states that I don't need to. Thanks.
Title: glCullFace makes SFML blind
Post by: niyaro on June 23, 2011, 01:56:09 pm
Hi,
I don't know for the rest of SFML (2.0) rendering, cause I use it's native functions only to draw text, but here we go:
Code: [Select]

glEnable (GL_CULL_FACE);
glCullFace(GL_BACK);

//glFrontFace(GL_CCW); This is an OpenGL's default
window->Draw(text); // doesn't render anything

glFrontFace(GL_CW);
window->Draw(text); // but this works fine

That means it's safe to assume that at least for text quads SFML uses wrong winding order. I think it should be considered a bug, Laurent :)
Title: glCullFace makes SFML blind
Post by: Laurent on June 23, 2011, 02:08:51 pm
That's right ;)

But the problem is not about what GL states SFML uses, it's more about how it interacts with user GL states. This will be improved soon.