• Advertisement
Sign in to follow this  

reading from a pbuffer

This topic is 4707 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to read from a pbuffer, but I'm not exactly sure how. I'm not trying to make a texture, I'm trying to read from a pbuffer for the use of a mouse map of a 3d landscape. I'm currently using glReadPixels, but that doesn't seem to work. Would I need to make a call to wglMakeCurrent(pbuffer_device,pbuffer_render_context) in order to correctly glReadPixels? Is there a better way to read from a pbuffer?

Share this post


Link to post
Share on other sites
Advertisement
Hi,

You should combine the pbuffer extension with the renter_to_texture. Once rendering in your pbuffer, when switching back to your original context(the visible onscreen buffer or another pbuffer), this extension lets you bind your pbuffer as a texture so you can access it with regular texture coordinates. This far more efficient than glReadPixels functions:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_render_texture.txt

I would also suggest you to have a look at the framebuffer_object new extension, it is operationnal on Nvidias hardware with beta drivers(I don't know for ATI cards), and is really THE extension for doing offscreen rendering at "cheap" performance cost(have also lots of options and flexibility):
http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

Cheers, Jeff.

Share this post


Link to post
Share on other sites
Which Beta version drivers are you using for NVIDIA that supports EXT_framebuffer_object ?

Have you tried this ? If so on which graphics card ?

Share this post


Link to post
Share on other sites
I'm using the 76.41 drivers and yes I use framebuffer_objects in my code that does some complex multipass offscreen before final rendering. Here you go for the driver it will change your life :-)
http://downloads.guru3d.com/download.php?det=1022

It also has GLSL 1.10 support wich is great.
My card is a GF6600.


Cheers, Jeff.

Share this post


Link to post
Share on other sites
Quote:
Original post by funkeejeffounet

this extension lets you bind your pbuffer as a texture so you can access it with regular texture coordinates. This far more efficient than glReadPixels functions

Cheers, Jeff.


How would I access the pixel data of a texture?

Share this post


Link to post
Share on other sites
search for 'fragment shaders' and 'vertex shaders' on google.

Shaders are small programs run on the vertex and/or fragment processors of your video card.

Share this post


Link to post
Share on other sites
I get the idea of shaders, but how would they be used to read single pixel from a texture?

Share this post


Link to post
Share on other sites
Quote:
Original post by bigwiger
I get the idea of shaders, but how would they be used to read single pixel from a texture?


There's no way to get the value of a texel from a fragment shader. Except of course just rendering the texture with the fragment shader and using glReadPixels, but you don't need shaders to do that anyway so there's no point. The only way is what you were trying, glReadPixels. And as Aeluned said in the first reply, yes you do need the pbuffer's context to be current.
It may be possible to use glGetTexImage with a pbuffer, I'm not sure. But since you only want the value of 1 pixel glReadPixels is the best way.

Share this post


Link to post
Share on other sites
Quote:
Original post by funkeejeffounet
I'm using the 76.41 drivers and yes I use framebuffer_objects in my code that does some complex multipass offscreen before final rendering. Here you go for the driver it will change your life :-)
http://downloads.guru3d.com/download.php?det=1022

It also has GLSL 1.10 support wich is great.
My card is a GF6600.


Cheers, Jeff.



I think those drivers work only GeForce FX series and not for QuadroFX series, so I guess I can't use them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement