PDA

View Full Version : Complete GLUT include file anywhere?



Michael Hartlef
18-01-2009, 11:21
Hi folks,

by any chance, does someone have a complete converted include file for the GLUT library somewhere?

Michael

Petr Schreiber
18-01-2009, 12:31
Hi Michael,

I am sure José has one :)

But there is one catch - GLUT is all about callbacks. You pass CODEPTR to display, keyboard and other callbacks.
As ThinBasic is interpreted, its functions do not have pointers GLUT could use I think.


Petr

Michael Hartlef
18-01-2009, 13:03
Thanks Petr, but the PowerBasic includes are strangly not complete either I think. Or I'm blind as a bat. :D Have to look again.

Yes, callbacks are a problem with it. My approach would be to write a little module for these and then use a callback function in the module that itself calls a thinBasic script function that was set from a wrapping thinBasic command. Not such a bad solution, or?

Petr Schreiber
18-01-2009, 13:12
Hi Mike,

yes, that would be possible.
On the other side, I do not like much the "everything" callback approach in GLUT, I used it for my bachelors thesis and did not fell in love with it.

Currently, GLUT is considered "old", so recommended are FreeGLUT and OpenGLUT alternatives.

The idea for module would be wrapper just for the callbacks as you say.
That would mean:

Exposing TBGLUT_BindFunction( functionName, type ) for TB programmer, it would retrieve pointer to ThinBasic function ( type would be equate %DisplayFunc, %KeyboardFunc, ... )
Inside module, there would be different hidden callback functions which would in reality handle the events, and then pass DWORD pointer to ThinBasic functions they would invoke in the end. Pointer would ... point to some global parameters buffer inside the DLL


And then there is theoretical possibility to make it all ThinBasiced - the function pointers would be to functions in Oxygen assembly, but not sure if Oxygen code can call ThinBasic "normal" function back.

José Roca
18-01-2009, 13:24
The translations that I did for PowerBSIC 8.+ are still available here: http://www.jose.it-berater.org/smfforum/index.php?topic=812.0

Michael Hartlef
18-01-2009, 15:33
Thanks Jose, I will look at these. Maybe I mixing up GLUT32.h and GLU.h .

Petr, don't worry, I won't use it for TBGL. I just was converting a C sample.

Michael Hartlef
18-01-2009, 15:37
Hi Petr,

here is the script. As you can see, it doesn't quite work like it should.

Cheers
Michael

Petr Schreiber
18-01-2009, 17:08
Hi Mike,

I was converting exactly the same code :D.
The reason it does not work now is because TBGL does not allocate stencil buffer by default (it is useful only in some cases and eats memory).

When I moded the sources to use 1 or 16 bit stencil buffer, the result of rendering changed ... to something little odd. It is more like box painted in black over the rest. I enabled lights... well, it looks a bit weird to me.
You can see the back side of box is modified to copy the shape of sphere... well, odd.

Petr Schreiber
18-01-2009, 17:28
Hmm,

I got some ideas... I cannot dedicate more time to it today,
but I attach here highly experimental TBGL with stencil buffer support just for purpose of this tests.

! Do not use for anything else !

For testing purposes, it is better to use gluQuadrics for now, attached sample using 2 spheres.

Michael Hartlef
18-01-2009, 22:39
Looks good. Funny you worked on the same sources. :)