Results 1 to 3 of 3

Thread: getting a single value back from the shader/gpu

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    16

    getting a single value back from the shader/gpu

    Hi,
    I am displaying some slices of a 3d texture. In order to obtain the pixel coordinate in my original 3d image volume that is pointed to by the mouse i have used an offscreen render of an integer coded texture. Just a sequntial numbering of the pixels. This worked well but can i do this in a neater way? I use two shaders at the moment and they are identical except one renders the integer coded pixel number to an integer buffer. It would seem simpler with one shader, but is there a way to do this?
    My understanding is i cannot render to both an rgba and an integer RBO from the same shader.
    Is the only way to get a variable of the frag shader through rendering or is there something i have missed?

    Thanks
    Soren

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,676

    Re: getting a single value back from the shader/gpu

    My understanding is i cannot render to both an rgba and an integer RBO from the same shader.
    ... says who? There's absolutely no reason you can't render to both. You just need to set the proper glDrawBuffers and glBindFragDataLocation stuff correctly, so that the integer output is piped to the integer buffer.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    16

    Re: getting a single value back from the shader/gpu

    Thanks!
    That is good news.
    Looking at my fifth edition superbible I think it boils down to me misunderstanding a sentence on frame buffer completeness and unsupported combinations of internal formats.

    In any case I will give this a shot after work - thanks again.

    Soren

Similar Threads

  1. Return single integer from fragment shader.
    By Trionet in forum OpenGL: Advanced Coding
    Replies: 18
    Last Post: 08-09-2015, 08:34 AM
  2. Managing several versions in a single shader file
    By gsourima in forum OpenGL: GLSL
    Replies: 14
    Last Post: 02-03-2015, 08:47 AM
  3. shader front/back face and ccw ,cw
    By giugio in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-02-2011, 06:21 AM
  4. Changing Uniform Variables for a Single Shader
    By turbosausage in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 07-22-2010, 03:49 AM
  5. Flow Control : Using Single Shader HELP
    By Jedimaster in forum OpenGL: GLSL
    Replies: 4
    Last Post: 07-03-2006, 12:28 PM

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