Login  Register

Re: Help with shaders

Posted by Martin on Feb 18, 2012; 1:34pm
URL: https://forum.jogamp.org/Help-with-shaders-tp3737063p3756317.html

I found a clue, while trying to create the most simple and stupid shader pair making no change to the fixed pipeline instructions:

---------------------
vertex shader:
---------------------
void main(void)
{
        gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
}

---------------------
fragment shader:
---------------------
void main(void)
{
        gl_FrontColor = gl_Color;
}

---------------------
What was strange, is that gl_FrontColor (and also gl_BackColor) seam the only way to properly "retrieve the original color".
Following output variables always produce black pixels:
1) gl_FragColor = gl_Color; // make black content
2) gl_FragData[0] = gl_Color; //make black content

That's weird because the example programs I am trying to integrate make extensive use of gl_FragColor and sometime gl_FragData and it works perfectly.

Do you think I miss an option/setting?