Can't find uniformsBlitzMax Forums/BlitzMax OpenGL Programming/Can't find uniforms
| Hey guys,|
I've been trying to add shader support into my game written with normal Max2D.
I've written this extension for max2d:
I know it's very ugly but right now I only care about functionality.
So I've tested this in a separate app and it works great. I tested it in the game (only the desaturated shader) and it worked great. In the editor however it won't work at all.
Everything is set up, the max2d driver, glew, the shader is linked well but I keep getting -1 on the uniform locations and I just don't know what to do. The shader I use there is different but it doesn't matter since it won't even work with the dessaturated shader I tested in 2 other places.
Just so there is no confusion I'm gonna post the code for that shader:
gl_TexCoord = gl_MultiTexCoord0;
gl_Position = ftransform();
uniform sampler2D tex;
float4 t = texture2D(tex,gl_TexCoord.st);
float d = (t.r+t.g+t.b)/3.0;
gl_FragColor = float4(d,d,d,t.a);
Does anyone have any idea as to why this doesn't work?
I've been working with opengl for at least 5 years now and never once did I encounter such a weird thing.
Thanks a lot
| Never mind, didnt read the post properly !!! Sorry.|
Last edited 1+ years ago
| Found it.|
It didn't take me this long but I was quite busy with RL things.
If you create a shader having set the graphics on one canvas and then try to draw using that shader on another canvas you won't find the location of the uniforms.
I will check on a sollution for this.
On another note, we need a new Max2D that works the same but with shader support(both ogl and dx). It's 2011 already...
I swear that when I'll have some free time I'll start working on one and release it for free and everything.
| Give it a shot with GLShareContexts().|
That should fix it.