Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Where to interpolate

  1. #1
    Newbie Newbie
    Join Date
    Dec 2017
    Posts
    1

    Where to interpolate

    Im struggling with an texture ontop of a two triangles,

    recently when I only had a vertex Shader and a Fragment shader, everything worked fine, with applying the texture to the square.

    but Then I added the geometry shader and the square just picks up one color.

    I used a varying variable to pass the texCoord between v shader and f shader, am I supposed to use a varying var from v shader to geometry shader instead or just from geometry to f shader?

    Where does the interpolation usually take place?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,516
    Quote Originally Posted by Giraffpaj View Post
    recently when I only had a vertex Shader and a Fragment shader, everything worked fine, with applying the texture to the square.

    but Then I added the geometry shader and the square just picks up one color.

    I used a varying variable to pass the texCoord between v shader and f shader, am I supposed to use a varying var from v shader to geometry shader instead or just from geometry to f shader?
    When using a geometry shader, there is no automatic "pass through" of variables between the vertex shader and the fragment shader. For each variable which would form part of the interface between a vertex shader and a fragment shader, a geometry shader needs corresponding input and output variables and must explicitly copy the appropriate element of the input array to the output variable for each vertex.

    Use of interface blocks allows you to avoid having to choose different names for input and output variables. It also means that you can add and remove the geometry shader without having to change the other shaders.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •