Original Post
Hello, I an attempting to draw pre-rendered color and depth data to the framebuffer so that it interacts correctly with geometry. To simplify the problem, lets say I have a single RGBA buffer with color data, and a single float buffer with depth data (and by buffers, I mean a standard C++ style buffer). All I want to do is quickly draw this data to the framebuffer, then draw some geometry and have it intersect correctly. I started out using a textured quad to draw the color data, and glDrawPixels to fill the depth buffer. This worked correctly, however when zoom factors less than 1.0 are used, all nVidia cards that I tested slowed down to a crawl (obviously they were dropping down to software rendering when scaling down float data). After a ton of research, the only other method I was able to find to fill the depth buffer was to use shaders. So I started experimenting with GLSL and float textures. So far I've tried the following: 1. Using a GL_DEPTH_COMPONENT texture and the shadow functions to access the depth values in the shader. This works perfectly on nVidia cards, but not at all on ATI cards. It's very possibly that I was just doing something incorrectly and that was why the ATI cards weren't working, so if you think this should work then a small sample would be very appreciated! 2. Using a GL_LUMINANCE32F_ARB/GL_LUMINANCE_FLOAT32_ATI texture and the standard texture accessors in the shader. This worked perfectly for cards that supported the necessary extensions, however we have several older Quadro cards that we need to support that don't have any floating point texture extensions (other than the ARB_depth_texture extension). Now I'm attempting to encode the float depth values in a standard RGBA texture, but I'm having difficulties getting the float values correct in the shader without any bitwise operators. I've seen code floating around that uses GLSL to encode and decode a float value to 4 int8 values, but I am trying to avoid having to manipulate the float buffer that I have (the depth values change fairly frequently, so it would be a time consuming process to have to encode the entire float buffer into a different int8 buffer before passing it to the texture). So finally my question - is it possible to pass a C++ float buffer to a RGBA texture, and get back the float values in a fragment shader? I realize that with what I already have working, it would be possible to have separate render paths that would work based on what the hardware supports, but I would prefer to keep the rendering code as simple as possible. If there is a way to use a standard RGBA texture for float values, then I figure that would be the most supported solution. Sorry for the long post! I would appreciate any suggestions or examples! Kelly