View Full Version : sampled texture lookup without the use of a shader
07-31-2008, 01:32 AM
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.
07-31-2008, 02:58 AM
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
07-31-2008, 04:33 PM
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:
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, zTexture, 0);
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT32, width, height);
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb);
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.
08-01-2008, 12:26 AM
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...)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.