Jump to content
  • Advertisement
Sign in to follow this  
Jacob Jingle

Geometry Shader Error

This topic is 2082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My shader worked perfectly before recent Nvidia Update. Now I'm getting the error "ARB_separate_shader_objects requires built-in block gl_PerVertex to be redeclared before accesing its member." I'm new to GLSL shaders, and I just don't know what to do...Any help is greatly appreciated.


If I add:

out gl_PerVertex
  vec4 gl_Position;


It compiles with no errors but nothing is drawn.


#version 430

#define POSITION	0
#define GEOMUV      1
#define INDEX       2
#define FRAG_COLOR	0

layout(points) in; // x, y, width, height
layout(triangle_strip, max_vertices = 4) out;

uniform mat4 MVP;

in Data
    ivec4 pos; // x, y, width, height
    vec2 UV;
    flat int Index;
} vdata[1];

out Data
    vec2 UV;
    flat int Index;
} gdata;

void main() 
  int x = vdata[0].pos.x;
  int y = vdata[0].pos.y;
  int widthx  = vdata[0].pos.z + vdata[0].pos.x;
  int heighty = vdata[0].pos.w + vdata[0].pos.y;

  // bottom left quad
  gl_Position   = MVP * vec4(x, heighty, 0, 1);
  gdata.UV      = vec2(0.0, 0.0);
  gdata.Index   = vdata[0].Index;

  // bottom right quad
  gl_Position   = MVP * vec4(widthx, heighty, 0, 1);
  gdata.UV      = vec2(1.0, 0.0);
  gdata.Index   = vdata[0].Index;

  // top right quad
  gl_Position   = MVP * vec4(x, y, 0, 1);
  gdata.UV      = vec2(0.0, 1.0);
  gdata.Index   = vdata[0].Index;
  // top left quad
  gl_Position   = MVP * vec4(widthx, y, 0, 1);
  gdata.UV      = vec2(1.0, 1.0);
  gdata.Index   = vdata[0].Index;



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!