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.
Well if it’s simple multisampling on a larger magnitude than the other “hardware” multisampling methods do, then yes it’s easy.
- 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
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.
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…)