possible to have opengl in a command line program?

Started by
4 comments, last by Chris_F 10 years, 4 months ago

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

Advertisement

What exactly is the question? How to open up a context or how to send the render over tcp/ip?

Does it have to be rendered via OpenGL, or would you be able to do it by raytracing with something lik http://www.yafaray.org/ or http://povray.org/ instead?

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

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.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

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.

This topic is closed to new replies.

Advertisement