Forums > Jitter

Attribute variables in GLSL


jin
October 22, 2009 | 6:29 am

Hello.

This maybe very silly or beginner’s question.
However, please someone answer this question so I can go on.

I just started to dig into glsl.
I took workshop hosted by Wesley Smith in Korea, read Andrew Benson’s ‘your first shader’, and checked ‘jitter-shaders’ in max5 folder.
And finally started to read orange book.

I encountered a problem when I tried to implement the first shader in orange book into jitter.
I never saw variables attribute used in previous reading.
I’m stuck.
I read over and over but I can’t fully understand how attribute works.

first shader in orange book
——————————————————–
//vertex part
uniform float CoolestTemp;
uniform float TempRange;

attribute float VertexTemp;

varying float Temperature;

void main()
{
Temperature = (VertexTemp – CoolestTemp) / TempRange;

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

//fragment part
uniform vec3 CoolestColor;
uniform vec3 HottestColor;

varying float Temperature;

void main()
{
vec3 color = mix(CoolestColor, HottestColor, Temperature);

gl_FragColor = vec4(color, 1.0);
}
———————————————

How can I implement attribute variable into jitter way?

I checked the post Wes uploaded a while ago.
http://www.cycling74.com/forums/index.php?t=msg&goto=78187&rid=5580&S=1863eae0d9d8795fe88748e5124adcd1&srch=attribute+variables#msg_78187
I changed the 3 values for ‘p Displace’, nothing happened.

Please help me out!
Thank you.
Jin



jin
October 22, 2009 | 6:33 am

Wes, can you upload the file again?
The link is broken.
It must help.
http://www.mat.ucsb.edu/~whsmith/vertex_attr.zip


October 22, 2009 | 8:08 pm

a quick search for vertex attributes reveals this post as the top match:
http://www.cycling74.com/forums/index.php?t=msg&goto=163219&rid=3061



jin
October 23, 2009 | 3:23 am

Thanks.
I checked that before and didn’t understand fully.
I’m checking ‘v001.rutt-etra’ patch right now.

I maybe asking too much for the level of my knowledge…..sad..

I just skip for now and go on for next one.
However, I’ll come back on this.


Viewing 4 posts - 1 through 4 (of 4 total)