Vert shader - no frag shader

okay, ive got a little skinning demo working, and its only a vertex shader. Now the problem seems to be that i can’t apply a texture.

im just getting a black mesh!

i’ve set up uv coords like so:
gl_TexCoord[0] = gl_MultiTexCoord0;

now when debugging i added the line:
gl_FrontColor = gl_MultiTexCoord0;

after adding this i can now see the texture blended with some funkey colours (my uv coords as colours).

does gl_FrontColour have to be set to some value?
setting it to white seems to do the job.

would be nice not to have to include this line though?

must gl_FrontColour always be set if no fragment shader is used, and why?

Simple answer from the GLSL spec:

“7.6 Varying Variables

The following built-in varying variables are available to write to in a vertex shader. A particular one should be written to if any functionality in a corresponding fragment shader or fixed pipeline uses it or state derived from it. Otherwise, behavior is undefined.
varying vec4 gl_FrontColor;
varying vec4 gl_BackColor;
…”

The previous generation programmable pipeline extensions initialized the registers to a defined state on each invocation, that’ll be black in your case and if your texture is set to modulate, black*anything gives black.
(It’s a good idea to not use black as glClearColor during development.)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.