Results 1 to 3 of 3

Thread: Passing Colours Through Shaders

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2014

    Passing Colours Through Shaders

    Hello guys,

    I've just started learning OpenGL and need some help with passing through colours. When I had just a vertex and fragment shader, I could pass colours through simply. Then I added tessellation control and tessellation evaluation shaders, and am not sure how to pass them through. My ultimate goal is to apply lighting to a sphere, but right now I just need to get the colours working.

    In my vertex shader, I have this declared:
    layout (location=2) in vec3 colour;
    out vec3 v_colour;

    In my fragment shader:
    in vec3 v_colour;
    out vec4 colour;

    How can I pass it from the vertex shader through tessellation control and evaluation to the fragment shader?

    Thanks for any help.


  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Not a lot changes except the input is an array of all the patch vertices and you have to decide which input colour to use as an output for an output vertex - it may even be a computed colour

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2014
    Thanks for the reply. I've managed to get the colours working.
    I have another problem now. I've added a geometry shader (to implement Flat Shading), but it complains that it can't find my uniform mat4s when using glGetUniformLocation (which are declared in the Tessellation Evaluation shader). How can I fix this?

    EDIT: Never mind, I had an empty main function in the GS. When I put pass-through code in, the problem was resolved.

Similar Threads

  1. Passing through multiple shaders
    By PropPutty in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-08-2010, 12:35 PM
  2. Passing data from several vertex shaders
    By Vadim in forum OpenGL: GLSL
    Replies: 10
    Last Post: 02-04-2010, 07:02 PM
  3. problem with passing textures to GLSL Shaders
    By divas in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-17-2009, 12:16 AM
  4. Passing Colour through shaders..
    By scratt in forum OpenGL: GLSL
    Replies: 5
    Last Post: 03-21-2009, 02:30 AM
  5. 32bit colours=fast! 16bit colours=very slow??
    By Useless in forum OpenGL: Advanced Coding
    Replies: 14
    Last Post: 09-25-2004, 05:25 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