0

I have code on CG. In this code vertex shader emit 3 parameters: vertex position (float4), texture coordinates (float2) and color (float4). But fragment program not defined. How shader use this 2 parameters (uv and color) on fragment shader?

toodef
  • 125
  • 1
  • 11
  • 1
    It might not use them in a fragment-shader. If you're using the fixed-function pipeline, it may use them for simple texture mapping and coloring. (For example if you have the texture parameters set up to modulate the texture with the fragment color, then it will multiply the color by the texture sample for each fragment, if I recall correctly.) – user1118321 Sep 07 '13 at 15:08

1 Answers1

1

Why not just define a fragment shader?

IIRC the default is to use the vertex value you assign to the connector register COLOR0 and no lighting. The texture assignment would need to be done by the OpenGL state machine (but you didn't tell us what context you're running in, so it might be DirectX, or who knows....)

bjorke
  • 3,295
  • 1
  • 16
  • 20
  • Thanks, i know how to write shaders on CG lang. But i need to convert CG code to GLSL. – toodef Nov 13 '13 at 13:21
  • I'm not following you. The default case for GLSL is still the same, the texture binding is managed by the encapsulating state block. And the vertex outputs will map to fragment shader inputs if you define one. – bjorke Nov 16 '13 at 19:06