Sign in to follow this  

Shader problem

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using an example shader from Shader Designer from http://www.typhoonlabs.com (toon.frag and toon.vert). The shader, in shader designer is a cartoonish shader, but loaded into my program, it makes everything black. The fragment shader is using the variables DiffuseColor, Phong and PhongColor, not mentioned anywhere in the GLSL reference, i guess thats where my problem occours, but i'm very new to shaders. Do i need to set these variables my self? - where do they get their from - since it is not a part of the shader either... In my program, I set up light, normals, materials etc. and i see the objects without the shader. I tried a couble of example shaders from shader designer, and it seems like a general problem. :( The shader sources can be found in [Shader Designer\shaders] but i'll list them here too: // Fragment/Vertex shader for cartoon-style shading // Author: Philip Rideout // Copyright (c) 2004 3Dlabs Inc. Ltd. // See 3Dlabs-License.txt for license information uniform vec3 DiffuseColor; uniform vec3 PhongColor; uniform float Edge; uniform float Phong; varying vec3 Normal; void main (void){ vec3 color = DiffuseColor; float f = dot(vec3(0,0,1),Normal); if (abs(f) < Edge) color = vec3(0); if (f > Phong) color = PhongColor; gl_FragColor = vec4(color, 1); } .vert: varying vec3 Normal; void main(void){ Normal = normalize(gl_NormalMatrix * gl_Normal); gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }

Share this post


Link to post
Share on other sites
You need to set the values for all the uniform variables (as you already surmised). It's been a while for me, so I can't give you detailed help, but if you check out the glUniform functions you should be able to set them with that.

Share this post


Link to post
Share on other sites

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this