pouët.net

Go to bottom

Help with shader (in iq's 1k framework)

category: code [glöplog]
 
Hi,

I downloaded iq's isystem package today and started playing around with the i1k_OGLShader. Getting it to work was surprisingly easy, but then I tried putting something different into the shader.h. I found a fun effect on glsl.heroku.com and tried it out. I think I have tried a lot now, but I just can't it to work. Can anyone spot what is wrong with the following paste of the the shader:

http://ideone.com/Rlyy9

It is taken from this effect: http://glsl.heroku.com/e#3684.0 .

I tried running the code from a normal OpenGL context based on glfw and OpenGL 3.3 shader and it worked just fine. I just can't put the finger on what I did wrong in the iq framework.

Can anyone point out what (one or many) mistakes I have made?
added on the 2012-08-26 20:31:53 by nakedman nakedman
The code can also be seen here https://github.com/madsravn/1k_demo
added on the 2012-08-26 20:40:33 by nakedman nakedman
gl_FragColor is deprecated.
And you have no #version marco defined - that means you get GLSL 1.10 - if that's what you want to have...

You might want to check the shader and program infologs.
http://www.lighthouse3d.com/tutorials/glsl-tutorial/troubleshooting-the-infolog/
You need to import the other needed functions by hand then of course.

You will get a "max version - compatibility profile" opengl context if you don't enforce core profile so you can go for #version 430 if your hardware/driver supports that - check GL_VERSION via glGetString.
added on the 2012-08-26 22:53:16 by las las
Thanks for the answer las.

I will take your idea about infologs and use that. But looking at the beforementioned shader code, I do not understand why it doesn't work when https://github.com/madsravn/1k_demo/blob/master/shader.h (line 14 - 28) works (It was what came with the system from iq). So the only thing I have changed is that small amount of shader code. and it went from working to not working. So I was thinking if anyone could see any obvious mistakes compared to line 14-28
added on the 2012-08-27 00:56:21 by nakedman nakedman
The comments in the glsl source strings are causing your problems. Specifically the comment in the string on line 33. That comment causes the rest of the glsl code to be commented out (because of the lack of newlines in the strings.)

If you want to keep the comments you could either move the comments outside the strings (like iq's original code) or add \n to each string.
added on the 2012-08-27 02:19:23 by datsua datsua
hah, det var en sej fejl 40 mads :-)
I copied your shader in GLSL sandbox and in my WebGL framework, and both they return an error in the for loop declaration.
Instead of
Code: float i = 0.0; for(i=0.0;i<loop;i++){


try

Code: for(float i=0.0;i<loop;i++){


ha, now it compiles (at least on GLSL sandbox) but I suppose the gl_FragColro thing should be somethign like gl_FragColor = vec4(color , 1.0);
uhmmm the sandbox is GLSL ES - that's something completely DIFFERENT.

Well - read the damn infologs and see WHY the shader does not compile - then come back...
added on the 2012-08-27 10:58:43 by las las
las: you're right; ignore the previous comment.
My point is: I try to help as far as he can figure out the problem himself - because it should be pretty easy to figure out why the shader does not work by looking at what the compiler says to the shader.
And it will be way more satisfying for nakedman to get things done by himself.

Btw. if you target 1k and you have a very current driver with GL 4.2 support you want to use glCreateShaderProgamv to setup your fragment shader - that will be smaller. That's why I mentioned checking GL_VERSION...

RTFS. (reading OpenGL 4.3/GLSL 430 Spec RECOMMENDED).
added on the 2012-08-27 12:48:33 by las las
@nakedman: Did you make it work ? Would be nice if you could share your effort as another sandbox thingy...
added on the 2012-09-01 14:09:08 by Kuemmel Kuemmel
I hope I was not to harsh.
added on the 2012-09-02 16:21:01 by las las
*too
added on the 2012-09-02 16:49:33 by las las
FWIW Well, you sounded grumpy - but I think they got the point of reading the manual first :)
added on the 2012-09-02 18:56:34 by mog mog
damn, the effect of lightpoints merging is used way to often at the moment... I wanted to use something simmilar as a background to some credits, but it's EVERYWHERE at the moment... those are the new ribbons...
added on the 2012-09-02 20:48:32 by FeN FeN
wut?
added on the 2012-09-04 18:03:20 by raer raer

login

Go to top