Results 1 to 3 of 3

Thread: triangle strip: which triangle am I in?

  1. #1
    Member Newbie
    Join Date
    Sep 2014
    Posts
    35

    triangle strip: which triangle am I in?

    When using triangle strips, is there any way for the fragment shader to know which triangle it's in? Does gl_PrimitiveID output per triangle (not per strip)? If so: I'm outputting vertices from a geometry shader, how can I get gl_PrimitiveID specified per-triangle still?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2010
    Location
    Oakville, ON, CA
    Posts
    165
    If you are using geometry shader, you can output any per-triangle data using the "flat" modifier for it. Set this variable(s) once just before emitting the last vertex of the triangle.

  3. #3
    Member Newbie
    Join Date
    Sep 2014
    Posts
    35
    Quote Originally Posted by Yandersen View Post
    If you are using geometry shader, you can output any per-triangle data using the "flat" modifier for it. Set this variable(s) once just before emitting the last vertex of the triangle.
    Thanks! But unfortunately I've abandoned the geometry shader - it didn't seem to play nicely with just about any drivers. Is there any way for the fragment shader to know straight from the vertex shader?

    Edit: Sounds like the same rules still apply https://www.opengl.org/discussion_bo...Triangle-color

Similar Threads

  1. Triangle Strip - Per Triangle color
    By Aliii in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-27-2013, 10:14 AM
  2. VBO Triangle Strip
    By Jeffg in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 01-08-2011, 10:01 AM
  3. triangle strip with a LINE triangle display error
    By Samme in forum OpenGL: Windows
    Replies: 22
    Last Post: 11-20-2008, 07:50 PM
  4. Triangle Strip!
    By golgoth13 in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 03-08-2006, 06:14 AM
  5. How To Triangle Strip?
    By imported_nomad in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 05-20-2002, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean