Xlib in a glut window

Hi everyone,

I was wondering if anyone knows if it is possible to call and render, say, xlib functions inside an opengl window, so that one could have, say, xterm running inside an opengl environment?

I know this probably sounds absurd, but it would be a neat trick.

Tony G.

OpenGL takes control over the framebuffer, and therefore you cannot do this. At least not in SDL, where you can’t use any SDL screen handling functions because OpenGL takes control. However I believe there is some workarounds for this problem. Keep looking, and report if you find anything.

thanks, that is good to know.

I’m not using SDL yet though… just glut for window creation. Do you find there is a big advantage to using SDL over other windowing abstractions (assuming this is what SDL does)?

take care,
Tony G.

I’m not sure about this as I’m not very familiar with libs like glut or SDL but since their job is to abstract xlib I doubt you’ll be able to do what you want using such a library. On the other hand if you open and setup an opengl window through xlib calls I suppose you would be able to call xlib rendering functions to draw on this window. Again I’m not entirely sure as I haven’t actually tried it.

Looking further into xlib might be an idea. However using xlib is extremly demanding, and you have do do a lot of function calls to achieve the same as with glut/SDL/Clanlib.

However, it might be possible to find your solution within xlib. Since OpenGL support is more of an extension to xlib, than integrated, I you won’t find anything, but still, don’t give up yet.

It shouldn’t be too hard I think. Just open a window, create a glx context and bind them. After that you can use opengl as usual, but you also should (I haven’t tried it) be able to use standard xlib calls with the window you created. But if you use xlib rendering then you are bypassing opengl so I don’t quite get whta you need that for. Maybe explaining what exactly you have in mind would save you some trouble…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.