In cocos2d-x, I am using particle system from plist with blend values: dst = 1, and src = 100 which is wrong enum for gl_blend.

Although app logged "OpenGL error 0x0500" but it still run and showed a good blend effect. And i can not find the right pairs of dst and src to recreate that effect.

So i hope someone can tell me how BlendFunc / gl_blend will work when it having bad src value. Base on that i hope i can recreate that effect without using wrong src value. Thanks


2 Answers 2


It's unspecified.

What that means is that the GL implementation is pretty much free to do whatever it wants. It might change nothing, it might reset to the defaults, it might make a best guess, it might do something else entirely different, and which of these it chooses might depend on other state set elsewhere. Also, you can't depend on somebody else's hardware doing the same thing.


Setting aside for a moment the question over whether or not calling an OpenGL function with illegal parameters will have an effect or not, here's how to actually get the information you want:

GLint blendSrc;
GLint blendDst;
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrc);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDst);

This code snippet will tell you what the current OpenGL src and dst blend states are. So if OpenGL's blending is behaving the way you want, this will tell you what values it's actually using.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .