Jump to content


OpenGL framebuffer and float format textures


  • You cannot reply to this topic
6 replies to this topic

#1 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 12 May 2006 - 08:03 AM

Hello.

I am implementing some image processing algorithms using OpenGL framebuffer and GLSL shaders. To do so I create framebuffer with float (32-bit) format, and also texture (also with 32-bit float internal format) - using GL_NV_texture_rectangle and GL_NV_float_buffer extensions. I want to use this texture as lookup in shader while I draw big quad all over the framebuffer. Is it possible?
The problem is that I always get 0 pixel values from texture2D() function in shader. If I change that lookup texture format to usual 32-bit RGBA (each color component is 8-bit byte), then shader recieves correct values and I get what I want. So is it possible to use float format textures in GLSL to render to framebuffer?

I have tested my code on GeForce FX 5200 and GeForce 7x00 (don't remeber exact number). Results are same on both videocards.

I can post some source code which I'm using for testing, if needed.

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 12 May 2006 - 03:06 PM

I've used float lookup textures in GLSL on my ATI Radeon 9600, to render HDR images, so it is definitely possible. If you're interested, look for the "Torrance-Sparrow" demo on my website (address is in my signature), as it contains code for setting up the float buffers, and GLSL shaders that sample them. You could compare it to your own and see if there are any major differences, be warned however that I haven't really tested this code on nVIDIA chipsets at all.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 12 May 2006 - 05:08 PM

From your sourcecode I understood that you are using PBuffers to perform rendering to texture.
But I want to use framebuffer object from GL_EXT_framebuffer_object extension. It doesn't depends on windowing system (wgl, glX) and performance is better, because there is no need to switch rendering contexts.

#4 tbp

    Valued Member

  • Members
  • PipPipPip
  • 135 posts

Posted 12 May 2006 - 06:49 PM

I've made a small post-processing thingy that works with fp16/FBO/NPOT etc etc... here
http://ompf.org/foru...topic.php?t=106

I've used fp16 because there's hardware support for filtering. But it worked with fp32 as well.

As i'm lazy at some point i've switched and put ogl 2.0 as a req.

Large pix here: http://ompf.org/ray/...te_my_shiny.png

#5 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 12 May 2006 - 07:25 PM

Thanx tbp!
I understood what problem I had. I used NV_float_buffer extension to get GL_FLOAT_RGBA32_NV texture internal format. Looking at your source code I found out that you are using ARB_texture_float extension to get GL_RGBA32F_ARB texture internal format. After changing this I get what I wanted :)

#6 tbp

    Valued Member

  • Members
  • PipPipPip
  • 135 posts

Posted 12 May 2006 - 07:29 PM

At your service. Dunno if you got the binary to work on your box as well, if so i'd be glad to know :)

Like i've said i now require ogl 2.0 because there was a tad too many extensions to fish for; but it's not strictly necessary. I'm afraid i don't have the source code for that anymore.

#7 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 12 May 2006 - 10:16 PM

No no, I didn't ran your code. I just looked at your source code, and changed a little bit mine.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users