Jump to content
  • Advertisement
Sign in to follow this  
billconan

OpenGL possible to have opengl in a command line program?

This topic is 2138 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

Hello guys,

 

I want to implement a program with opengl that renders something to a framebuffer object. I don't need to display anything, but I want to save the framebuffer into a jpg file and serve it via tcp/ip. the program is essentially a tcp image server. 

 

I will deploy this program to my server which has linux but no x windows. I can only access it through ssh. Suppose I have gpu on that server, how can I have an Opengl context within my command line program?

 

Thanks,

 

Shi

Share this post


Link to post
Share on other sites
Advertisement

bill, you will still need valid DRI rendering in order to get a GL context, ie, type this: `glxinfo|grep endering`

 

it should say "Direct Rendering: Yes", otherwise you need to configure your drivers...

 

so to run on a system without X installed, you can use Xvfb

 

And you'll probably want to look into GL FBOs aswell

Share this post


Link to post
Share on other sites

There is some work in progress to make open-source linux drivers offer acceleration without X windows.

 

I'm not sure if this has landed already, but if you have an up to date system (Mesa 10, fresh kernel and DRI), try creating an OpenGL context through EGL. It might just work.

 

Keep in mind that your commandline program will not have a default framebuffer, so you'll need to create and use a FBO in order to read back the result from the GPU.

Share this post


Link to post
Share on other sites

There is also OSMesa which has no dependencies on window systems or OS. It renders directly to a memory buffer, but you get software rendering only.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!