Jump to content

shader programming


DudeAwesome
 Share

Recommended Posts

I´m trying to get some experiences with shaders but I´m stuck because every example I find is outdated (because of openGL 4.0 is only supported)

 

 

I also find no entry in the documentation for the shader editor so someone could explain what

 

 

Control

Evaluation

 

means in the editor?

 

Vertex, geometry and fragment are my shadertypes ok but what is control and evaluation? where is tesselation shader?

 

I copy/pasted the example from wikipedia. the example should draw a silhouette

 

 

my vertexshader

 

void main(void)
{
gl_FrontColor = gl_Color;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

 

 

my fragmentshader

 

 void main(void)
 {
   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
 }

 

 

 

my error:

 

 

error(#272) Implicit version number 110 not supported by GL3 forward compatible context

error(#273) 1 compilation errors. No code generated

error(#272) Implicit version number 110 not supported by GL3 forward compatible context

error(#273) 1 compilation errors. No code generated

 

 

 

btw:

 

where can I see which functions are supported like "normalize()" ? where can I find a docu about that stuff? I cant see anything on this page or a link to get some info about that and I cant believe that I´m the only one who is interested in shaders

It doesn´t work... why? mhmmm It works... why?

Link to comment
Share on other sites

Most code for older OpenGL versions should still work under OpenGl 4. Control and evaluation are actually the two stages of the tessellation shaders, the first one defining the rules for the tessellation, the second one being executed after the tessellation has been done.

 

Unfortunately there isn't a lot of documentation about shaders in Leadwerks. Look for a recent thread calles "Shader uniforms", there will find variable names for the values that Leadwerks passes into the shaders. I think it's best to start looking at existing shader code (like the simple diffuse shader) and modify them to get a feeling.

 

Sorry, short answer but I only have limited internet access right now...

  • Upvote 1
Link to comment
Share on other sites

I am not aware of any restrictions, but the code you see and edit in the shader editor isn't the whole story. For one, the version information is kept elsewhere (actually, if you open the *.shader files in a text editor, you'll see that there a several shader variants for different OpenGL versions).

 

But more importantly, Leadwerks 3.1 uses a deferred renderer, while most shader examples you'll find in books or on the web are written for a forward renderer. While of course the GLSL syntax and basic principles are the same, there are some differences. Most notably, where at the end of a forward shader you write a value to gl_FragColor, thereby defining the final color for every fragment, in a Leadwerks 3.1 shader you fill up four buffers (fragData0 to fragData3, for their contents see that "shader uniforms" thread). After that, Leadwerk will do the lighting calculations etc. and do the final shading using those buffers.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...