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

Thread: sampled texture lookup without the use of a shader

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    2

    sampled texture lookup without the use of a shader

    I am rendering to a texture and want to do a filtered look up of that texture without the use of a shader as im just interested in the value.

    Im currently doing a glReadPixels to get the surrounding pixels of the coordinates i want and then performing my own dumb filter to get a value.

    I would really like to use the hardware to get this..

    It sounds easy, but i haven't been able to figure it out without the use of a shader.. Even so with a shader, im not sure how to set it up as i just want to retrieve the sampled lookup.

    Any help would be appreciated.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    748

    Re: sampled texture lookup without the use of a shader

    Well if it's simple multisampling on a larger magnitude than the other "hardware" multisampling methods do, then yes it's easy.

    1. render several layers with GL_ONE,GL_ONE blending and a dark color(determined on how many layers your doing) where the texture coordinates are adjusted a minute amount for every layer

    it's as simple as that, though to be sure not to get sampling artifacts use a float texture like GL_RGBA16F_ARB instead of the usual GL_RGBA

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    2

    Re: sampled texture lookup without the use of a shader

    Im not sure i explained myself correctly, perhaps sampled is the wrong term, I believe filtered is the correct term.

    Ill explain, I'm rendering a zdepth from an orthographic camera straight to a texture like so:
    glGenTextures(1, &zTexture);
    glBindTexture(GL_TEXTURE_2D, zTexture);
    glGenFramebuffersEXT(1, &fbo);
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, zTexture, 0);
    glGenRenderbuffersEXT(1, &rb);
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
    glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT32, width, height);
    glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb);

    //render


    And i would like a fast 'filtered look up' to gain the information from various coordinates in the texture.
    These values are only used in my code, and really have nothing to do with rendering.

    I hope this better explains what im trying to do.

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,370

    Re: sampled texture lookup without the use of a shader

    This out of the topic and maybe I misunderstand your notation, but zdepth means IMO, that you need to retrieve the depth buffer in a texture.

    If I am right, then you can get this data attaching a texture to the depth attachment point, with glFramebufferTexture2DEXT like you do for color attachment. This is would be faster than copy depth to a texture using color attachment and a shader (I assume...)

Posting Permissions

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