Critical: OpenGL API access in linux

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Critical: OpenGL API access in linux

Post by dracflamloc »

I had no idea that the OpenGL api was not available in linux pb. Its pretty ridiculus.

Please fred. Get this in ASAP.
No Sprite3d, no OpenGL... what am I supposed to use?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Opengl functions are quite easy to call...
But unfortunately creating a rendering context is really hard, that's why i've stopped linux for the moment...
And also I don't really like the fact that Purebasic is using external library such as sdl and gtk...
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

what? gtk sdl? pardon!? .. sorry very shocked.. what is he supposed to do re-write the entire of DirectX for windows and the WinAPI while he is at it? or have I gotten the wrong impression from your statements, please set me right?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

On Windows, he's using the Windows API, he could also have used GTK and SDL but he (hopefully) haven't done it (i wouldn't be using it if he had so)
On Linux, he is using GTK and SDL, instead of using Linux API and OpenGL. Which require to install third parties .so libraries.
That's why I don't really like the linux version. Hopefully, according to what i've seen, he won't do this mistake on the mac version ;)
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Ah screw it I'm just going back to C++
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

BTW, I've noticed something strange: I managed, using a Purebasic Library, to create an OpenGL Context. The only matter is that we can't use PB's Windows, we must use the api to create one. I've tried with Pb's one and i get an error. I'm sure it's GTK's related ;)
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Interesting... mind posting your code?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Wait... I've got a good idea ;)
Maybe I'll do, if i manage to do that, a library that wrap the whole OpenGL commands for linux, with a few functions that i'll have added ;)
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Well I'd still like to know how you managed to do it if you don't mind. If you'd like I can help you out too.

I just prefer to learn how to do something over just using someone else's lib.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

http://nehe.gamedev.net/counter.asp?fil ... glx.tar.gz

I more or less did a copy/paste of this ;)
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Link doesnt work, how'd you go about getting that code.

[edit]nevermind i found it.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

I'm still considering just using SDL in C++ though. I guess I'll have to try out both in pb and C++ before i decide which to go with. Theres benefits to both. Have you tried creating a separate PB window using the native pb commands and gadgets? I want a main game window and then a normal window with buttons and readouts, etc...
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

You shouldn't use sdl ;) I hate third parties libraries ;)
Anyway, I still don't manage to do OpenGL on GTK Windows...
What I'm nearly sure is that OpenWindow PB's command return GTK handle, and not the API handle... It seems to get the XWindow handle of the PB's window we should just do PeekL(WindowID()+8)... But it's not working for OpenGL it seems....
I just think it's not possible to do OpenGL with a "normal" GTK window...
I hate GTK more and more now :)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Could you test this :
http://gtnsoft.free.fr/OpenGL
You should see a black window for exactly 2 seconds ;)
Done with Purebasic, but unfortunately... It's an XWindow, so there's not way to handle Window events (well, not with the PB's functions...)

Why Fred has choosen GTK :cry: :cry: :cry:
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Weird....could you try global event handling and then just check to see if your xwindow has focus?
Post Reply