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 647685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:44:58+00:00 2026-05-13T21:44:58+00:00

I am trying to add some shaders to my old OpenGL program that draws

  • 0

I am trying to add some shaders to my old OpenGL program that draws a lot of GL_POINTS and some GL_LINES.

I created these two shaders:

Vertex shader:

void main()
{ 
    vec4 v = vec4(gl_Vertex);
    v.z = v.z + sin(v.x*v.x + v.y*v.y)/10.0;
    gl_Position = gl_ModelViewProjectionMatrix * v;
}

Fragment shader:

#version 120 

void main()
{
    vec4 myOutputColor = gl_Color;
    gl_FragColor = myOutputColor;
    //gl_FragColor.r = 0.5;
}

These two shaders compile and link without problems. And the vertex shader works great, I can see the GL_POINTS displaced using that sin in the vertex shader. But the problem is I can only see my GL_POINTS and GL_LINES if the background color is not black because all points and lines are rendered black. It seems that all the colors set with glColor3f in the rendering code are ignored. If I uncomment the commented line in my fragment shader I can make all lines and points red, but shouldn’t gl_Color correspond to the color that was set with glColor3f for each point?

Is there anything else in my OpenGL code that could cause this behaviour?

  • 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-13T21:44:58+00:00Added an answer on May 13, 2026 at 9:44 pm

    you need to pass the color through in the vertex shader.

    gl_FrontColor = gl_Color;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.