Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6062985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:06:50+00:00 2026-05-23T09:06:50+00:00

I have pass-through vertex and fragment shaders. vertex shader void main(void) { gl_TexCoord[0] =

  • 0

I have pass-through vertex and fragment shaders.

vertex shader

void main(void)
{
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

fragment shader

void main(void)
{
    gl_FragColor = gl_Color;
}

Those produce empty rendering (black not background color like glClearBuffer does).

If I modify the vertex shader to set the gl_FrontColor to gl_Color it does render untouched OpenGl buffer … with is the expected behavior of pass-through shaders.

void main(void)
{
    gl_FrontColor = gl_Color; //Added line
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

I am confused, how settings the gl_FrontColor in the vertex shader can change the value of the gl_Color in the fragment one ? What I am missing ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:06:51+00:00Added an answer on May 23, 2026 at 9:06 am

    gl_Color means different things in different places.

    In the vertex shader, gl_Color represents the primary per-vertex color attribute passed by the user. This is set using glColor* calls or array data fetched by glColorPointer.

    In the fragment shader, gl_Color represents the interpolated color for the facing of the triangle being rendered. Remember that triangles have a front-face and a back-face. If you enable face culling, then all faces of one kind or the other (or both) are not rendered. However, if you turn off face culling, then both sides are rendered.

    It is often useful to have different per-vertex output values based on the particular facing of the triangle. The primary color has a front color and a back color, representing the color for front-facing triangles and back-facing triangles. The vertex shader outputs for these are gl_FrontColor and gl_BackColor.

    If you are doing two-sided rendering, you will need to set both of these values in order for the fragment shader’s gl_Color input to mean anything. If you are only doing front-face rendering, then you only need to set gl_FrontColor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have multiple has_many :through relationships that pass through each other
I have a projectile that I would like to pass through specific coordinates at
I have an object id currentObject; which I want to pass through notification. The
I have a for loop that I pass through ssh to a server that
I have to pass a variable through an animation sequence, but I'm having trouble
I have a dynamic body incorrectly pass through static body so am I missing
I have a number of pass-through queries setup in a MS-Access database with pre-defined
I have to pass parameters between two rails apps. In one side (sender) I
I have to pass some parameter from an action to another action,for example to
You have to pass the args variable to the anonymous function, but the anonymous

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.