PDA

View Full Version : what's the best way to do off-screen rendering with GPU acceleration



xdf103
12-05-2006, 10:58 PM
hi, i would like to use OpenGL for off screen rendering (i.e. no windows are opened) with GPU acceleration. which library shall I use and any example of how to use it?

xdf103
12-05-2006, 11:00 PM
i am looking for something like osmesa but with GPU acceleration

k_szczech
12-06-2006, 12:06 AM
You can use pbuffer to create offscreen rendering context.

xdf103
12-06-2006, 12:08 AM
thank you! do you have an example for that?

xdf103
12-06-2006, 06:09 PM
i tried pbuffer, but it can only work on a local machine, i.e. i cannot start the job from another computer using ssh. i want to dispatch a job to run on several computers. is there a way to do this with pbuffer?

hseb
12-07-2006, 12:01 AM
Hmmm...
For me, the best way is to use the extension GL_EXT_framebuffer_object.

http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

http://download.nvidia.com/developer/presentations/2005/GDC/OpenGL_Day/OpenGL_FrameBuffer_Object.pdf

ZbuffeR
12-07-2006, 10:13 AM
Originally posted by xdf103:
i cannot start the job from another computer using ssh.To have hardware acceleration you need a X server with GLX. Even if the window is not displayed (hidden etc.).
So in this case you need to export DISPLAY={ip of distant server}:0.0 for your GL application to work. See xhost documentation to have the proper rights. You can test with running xterm from a distant machine, and when you get the xterm window show up on the machine which will run OpenGL commands, the setup is ok.

hmm messy, but should work. That is the price to pay for hardware acceleration, it is tyied to the videocard.

xdf103
12-07-2006, 05:13 PM
thanks! below is what i did:

1. login to remote server using ssh
2. export DISPLAY=:0.0
3. use xhost to add local server to remote server and remote server to local server
4. run the program

i still got the error "could not connect to x server".

for the DISPLAY, i tried both {local ip}:0.0 and {remote ip}:0.0. neither works.

did i miss anything?

xdf103
12-07-2006, 05:17 PM
Originally posted by hseb:
Hmmm...
For me, the best way is to use the extension GL_EXT_framebuffer_object.

http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

http://download.nvidia.com/developer/presentations/2005/GDC/OpenGL_Day/OpenGL_FrameBuffer_Object.pdf actually i am using framebuffer object too, but i use pbuffer to create an off screen rendering context. is there a way to create the rendering context without creating either a display window or pbuffer?

hseb
12-08-2006, 12:12 AM
ok. I hate pBuffer... too heavy interface... ;-)

So with FBO, you can attach a texture with the size you want(same res as the screen rendering context if you want) then render inside it what you want. After, this texture can be used as a normal texture.

A simple and nice tutorial :

http://www.gamedev.net/reference/programming/features/fbo101/

hope it will help you...

ZbuffeR
12-08-2006, 01:26 AM
Originally posted by xdf103:
i still got the error "could not connect to x server".Maybe there is no X server running on distant machine ? Do you have physical access to it ? You can try with a basic X program such as xterm or xlogo, and check the GL-related stuff later.

I can't test at the moment, but searching "run X display env xhost" without quotes in a search engine can help.
This looks pretty good :
http://scv.bu.edu/Graphics/xstuff.html#XAPPLICATION

SFRuckus
12-08-2006, 06:39 AM
You may try 'ssh -X remote-machine' or 'ssh -X your-username@remote-machine' to login. This sets up your environment and connections under normal circumstances. I prefer this over the older ssh/rsh/xhost+/export business.

-SFR

xdf103
12-08-2006, 10:00 PM
thanks all for the replies! i finally got the thing to work after disabling x server access control on the remote server.

as for pbuffer, i don't like pbuffer either. in fact, i only used pbuffer to create an active rendering context and all the processing are done using FBO. as most of the work involves rendering into some texture objects with different dimensions, FBO is more appropriate. is there a way to create a off screen rendering context without using pbuffer?

glBug
12-10-2006, 10:28 PM
Originally posted by SFRuckus:
You may try 'ssh -X remote-machine' or 'ssh -X your-username@remote-machine' to login. This sets up your environment and connections under normal circumstances.
-SFR ...given the ssh service is configured to allow X11 forwarding. Check [or ask your admin to check] if /etc/ssh/sshd_config [or wherever is your sshd_config file] has the following settings:

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes