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 3 of 3

Thread: A simple question

  1. #1
    Intern Newbie
    Join Date
    Apr 2004
    Location
    France
    Posts
    31

    A simple question

    hi,

    The format of my depth texture is GL_DEPTH_COMPONENT but when I'm reading the texture in fragment program I have a rgba value. So what is the solution to get the correct floating value which is in the depth texture ?
    float depth = texture2D(myTexture, vec2(gl_TexCoord[0])).x; ?

    thanks

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: A simple question

    AFAIK if texture format is GL_DEPTH_FORMAT you can access the textures depth with .x (just like your example).
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  3. #3
    Intern Newbie
    Join Date
    Apr 2004
    Location
    France
    Posts
    31

    Re: A simple question

    ok thanks

Posting Permissions

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