Page 1 of 1
xlib residents
Posted: Thu Feb 13, 2014 5:20 pm
by luis
I was looking at the structures in the residents.
There is much GTK stuff, but no xlib stuff.
Is there some way I didn't see to access all that or I have to convert what I need from Xlib.h to PB code ?
And I suppose have to import the various xlib function by myself.
Maybe someone else already did some of this and is willing to share something ?
Just asking before starting a lot of work when maybe I can avoid some

Re: xlib residents
Posted: Fri Feb 14, 2014 1:41 am
by luis
Well, I'll start in the meantime and good luck to me

Re: xlib residents
Posted: Fri Feb 14, 2014 9:02 pm
by idle
I don't have any xlib includes but I'm curious as to what you need it for?
over come windowed screen issues perhaps ?
Re: xlib residents
Posted: Fri Feb 14, 2014 10:07 pm
by luis
No, I'm just experimenting with opengl for a library I'm making (SGL, I've
mentioned it sometime on the forum).
I've made the core part of the library on Windows doing all in PB from scratch, and using a lot of API (hello Chris

) for the windowing/keyboard/mouse/rendering context parts.
Before going forward I was curious to see If I would be able to do the same for Linux. After some investigations (and experiments) I've decided the best route, equivalent to the one I've used on Windows, was to not rely on GTK (and its X11 wrapped stuff available there) and going straight for xlib.
I hoped to find the residents already in PB but it wasn't the case.
I'm progressing, certainly it's something a lot harder for me to do than under Windows.
I've zero practical experience, and the documentation under Linux doesn't seem comparable to what we have under Win.
Or maybe I'm not enough used to the environment, yet.
Certainly someone with Linux and OpenGL experience could do this faster/better than me but even if I fail I'll end up learning something

And I'll try again later !
Re: xlib residents
Posted: Fri Feb 14, 2014 10:51 pm
by idle
Probably easier to take a look at the sources of glfw and freeglut if the xlib documentation isn't clear enough.
Re: xlib residents
Posted: Fri Feb 14, 2014 11:07 pm
by luis
The biggest problem I've found so far is the correct conversion of the structures.
Using GCC a long should be the equivalent of .i , an int should be the equivalent of .l, pointers are all .i, and then 50% of the fields are typedef defined and then redefined and then redefined again and you have to backtrace them to the source, then there is the right alignment to consider.
Probably I'll have to use GCC in parallel to verify my assumptions...
This part it's not a lot of fun.
Re: xlib residents
Posted: Fri Feb 14, 2014 11:39 pm
by idle
yes the typedefs can be a pain when there's multiple redefinitions
Re: xlib residents
Posted: Sat Feb 15, 2014 10:06 pm
by luis
UPDATE -> Oh yeah !
Two things:
Align #PB_Structure_AlignC
It's really a time saver. Fred thank you very much for adding it (and to everyone requesting it).
And second: I've just witnessed a window popping out from nowhere, with a rendering context and a nice GL triangle on it and with some minimal event processing already in place !
All created from zero using just Xlib and nothing else, not a bad start considering I've started looking at Xlib 48 hours ago
yippie-kai-yay !