You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure why but as soon as you enable smoothing, additive blending is disabled. In fact I think someone on the team is also unsure - see the comment "why do we need this?" in libs/openFrameworks/gl/ofGLRenderer.cpp :)
//----------------------------------------------------------voidofGLRenderer::startSmoothing(){
#ifndef TARGET_OPENGLES
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
#endifglHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
//why do we need this?glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
I commented it out and it seemed to work OK, but I'm sure there are other repercussions. But it would be nice to have smoothing and blendmodes.
cheers
Seb
The text was updated successfully, but these errors were encountered:
I think I read somewhere that you need GL_BLEND enabled in order for GL_LINE_SMOOTH to work.
But I am also having some problems with this. And was going to suggest some kind of internal state-keeping for the blend mode, instead of using pushAttrib/popAttrib.
Do we lose efficiency? Having to check if some kind of blending is already enabled, instead of pushing/popping attribs every time?
@sebleedelisle you're right this is a bug of sorts.
we should check if blending is currently enabled and if so, not set a different blend mode.
we can do this if blending is set through the ofEnableBlendMode method. If you are using OpenGL directly then it won't work and you might still have an issue.
An easier way to solve your problem, is just to do ofEnableSmoothing() at the beginning of your app and then do your additive blending calls any point after that.
Yep I just wasted quite a few hours on this; if ofEnableSmoothing() has been called at any time, every draw call (to ofMesh, etc) re-sets the blending mode. This is particularly painful if you are doing pingpong shaders as every fbo->draw() re-enables the blending and gives very bizarre results.
Hi guys!
I'm not sure why but as soon as you enable smoothing, additive blending is disabled. In fact I think someone on the team is also unsure - see the comment "why do we need this?" in libs/openFrameworks/gl/ofGLRenderer.cpp :)
I commented it out and it seemed to work OK, but I'm sure there are other repercussions. But it would be nice to have smoothing and blendmodes.
cheers
Seb
The text was updated successfully, but these errors were encountered: