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

  • Home
  • SEARCH
  • 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 3310626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:46:55+00:00 2026-05-17T21:46:55+00:00

I am just messing around with some geometry shaders taking a list of GL_POINTS

  • 0

I am just messing around with some geometry shaders taking a list of GL_POINTS and outputting a box with triangle strips. i have it basically working but when i zoom in/out or pan around the triangle strips go all over the place and do not maintain their posistion in the world but are still correctly drawing the box.

for example if i give the input (5,5,0) it will draw a triangle strip with these points to make a box:

(5 , 5 , 0)
(5.5, 5 , 0)
(5 , 5.5, 0)
(5.5, 5.5, 0)

Vertex Shader:


// Vertex Shader
#version 130

in vec4 vVertex;

void main(void)
{ 
    gl_Position = gl_ModelViewProjectionMatrix * vVertex;
}

Geometry Shader:


version 130 
#extension GL_EXT_geometry_shader4 : enable

void main(void)
{
    vec4 a;
    vec4 b;
    vec4 c;
    vec4 d;

    int i = 0;
    for(i = 0; i  gl_VerticesIn; i++)
    {
        a = gl_PositionIn[i];
        //a.x -= 0.5;
        //a.y -= 0.5;
        //a.z = 0.0;
        gl_Position = a;
        EmitVertex();

        b = gl_PositionIn[i];
        b.x += 0.5;
        //b.y -= 0.5;
        //b.z = 0.0;
        gl_Position = b;
        EmitVertex();

        d = gl_PositionIn[i];
        //d.x -= 0.5;
        d.y += 0.5;
        //d.z = 0.0;
        gl_Position = d;        
        EmitVertex();

        c = gl_PositionIn[i];
        c.x += 0.5;
        c.y += 0.5;
        //c.z = 0.0;
        gl_Position = c;
        EmitVertex();

    }
    EndPrimitive();

}

im probably missing something dumb.

  • 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-17T21:46:55+00:00Added an answer on May 17, 2026 at 9:46 pm

    Multiply each vertices by gl_ModelViewMatrix in your vertex shader instead. It’s far more easy to reason in world space.

    After that you can do what you do in the geometry shader, but don’t forget to multiply vertices by your projection matrix, before emiting them. This should fix your issue.

    Edit: I forget about ModelViewMatrix which transforms to view space, sorry. Just pass the vertex in the VS without doing nothing on it. That means you still will be in model space in the GS. Do your offset work in GS, then before emiting, transform with gl_ModelViewProjectionMatrix.

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

Sidebar

Related Questions

I'm just messing around with some C++ at the moment trying to make a
Just got an Arduino and I'm messing around having some problems with the lights.
Just starting to learn some basic C and messing around with the stat() system
I'm just messing around with some HTML5, and I was trying to center a
I've just started messing around with F# and am trying to do some basic
I've just started messing around with Windows Phone development, and I'm looking for some
Im just messing around with Ruby on Rails and HTML. This question isn't about
I was just messing around to answer someone's question here on Stack Overflow, when
I am just messing around trying to make a game right now, but I
I am just messing around with an app that streams audio and I wanted

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.