Results 1 to 4 of 4

Thread: How to color a texture in glsl

  1. #1
    Member Contributor
    Join Date
    Dec 2011
    Posts
    85

    How to color a texture in glsl

    I need to modify during runtime the appearence of textures..
    Some examples may be rendering them with a gray scale to indicate a deactivation, orange color for selection and so on


    A little example that better shows what I would like to achieve

    28.jpg


    Right now my FS looks pretty simple

    Code :
    #version 330
     
    in vec2 fragmentUV;
     
    out vec4 outputColor;
     
    uniform sampler2D textureNode;
     
    void main()
    {    
        outputColor = texture(textureNode, fragmentUV).rgba;
    }


    I thought I could control these few cases by setting an uniform variable to some hardcoded values...

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2013
    Posts
    186
    Just google for examples of Fragment Shaders for greyscale or Hue-Change. There are plenty of tutorials and examples, I can remember how I was looking for this about a year ago.

  3. #3
    Member Contributor
    Join Date
    Dec 2011
    Posts
    85
    Quote Originally Posted by Cornix View Post
    Just google for examples of Fragment Shaders for greyscale or Hue-Change. There are plenty of tutorials and examples, I can remember how I was looking for this about a year ago.
    And have you found anything working so far? Because the few clear examples I found dont work, such as http://gamedev.stackexchange.com/que...ion-brightness

  4. #4
    Senior Member Regular Contributor
    Join Date
    Sep 2013
    Posts
    186
    Yes of course, everything I found worked. Are you sure its the example? Perhaps you have made a small mistake at some point? Are you reading the error logs of the compiler and are you using debug output to see whats happening?

Similar Threads

  1. GLSL shader to boost the color
    By loki5100 in forum OpenGL: GLSL
    Replies: 1
    Last Post: 06-21-2018, 04:06 PM
  2. GLSL Color not working...
    By yj1214 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-06-2015, 10:00 PM
  3. question about color composing using GLSL
    By imported_billconan in forum OpenGL: GLSL
    Replies: 11
    Last Post: 02-03-2010, 09:29 PM
  4. Writing color and depth in GLSL 1.40
    By ijc12 in forum OpenGL: GLSL
    Replies: 5
    Last Post: 10-16-2009, 08:09 AM
  5. Drawing color affected by texture color
    By yossi in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-14-2001, 03:56 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