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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:32:02+00:00 2026-05-28T04:32:02+00:00

I’m trying to write a simple geometry shader what just passes through vertices before

  • 0

I’m trying to write a simple geometry shader what just passes through vertices before attempting to modify stuff.

My vertex shader is

#version 150 core
in vec3 inPosition;
in vec4 inColor;

out vec4 vertexColor;

void main() {
    vertexColor = inColor;
    gl_Position = vec4(inPosition, 1.0);
}

My geometry shader is

#version 150 core
layout (triangles) in;
layout (triangle_strip,  max_vertices=3) out;

void main() {
    gl_Position = gl_in[0].gl_Position;
    EmitVertex();

    gl_Position = gl_in[1].gl_Position;
    EmitVertex();

    gl_Position = gl_in[2].gl_Position;
    EmitVertex();
    EndPrimitive();
}

And my fragment shader is

#version 150 core
in vec4 vertexColor;
out vec4 fragColor;

void main() {
    fragColor = vertexColor;
}

Without the geometry shader linked in, everything works fine. However when I link in the geometry shader it stops working. What is it that I am missing? Does my Geometry shader require an input for the vertexColor from my vertex shader and if so how is that done?

  • 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-28T04:32:03+00:00Added an answer on May 28, 2026 at 4:32 am

    My geometry shader is exactly the same as the one listed on that page

    Yes, but your complimentary vertex and fragment shaders are not.

    Information flows through the OpenGL pipeline as follows: First, the vertex shader gets stuff. It passes its outputs to the geometry shader if present. The geometry shader passes its outputs to the fragment shader (after the customary triangle rasteriation, of course). And the fragment shader passes its outputs to the blend stage.

    Your vertex shader has two outputs: gl_Position, and vertexColor. Your geometry shader however only takes one input: gl_in[0].gl_Position. This is not legal in GLSL: if one stage outputs a value, the next stage must input it. The only exceptions are for GLSL-defined values like gl_Position, which is consumed by the rasterizer.

    Your pass-through GS needs to actually pass the data through if you want it to be pass-through. You need to take the proper input in your GS:

    in vec4 vertexColor[];
    

    However, global variables in GLSL can’t be named the same. So you can’t take vertexColor as an input and as an output. So instead, you have to change the name of the output (or use interface blocks):

    out vec4 gsColor;
    

    Your fragment shader must now take in vec4 gsColor; and work with that.

    When you attempted to link these shaders, your compiler should have given you an appropriate info-log explaining about the mismatch. Are you getting your info-logs when your shaders fail to link? If not, you should.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.