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
Hi folks,
by any chance, does someone have a complete converted include file for the GLUT library somewhere?
Michael
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
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Thanks Petr, but the PowerBasic includes are strangly not complete either I think. Or I'm blind as a bat. 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?
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.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
The translations that I did for PowerBSIC 8.+ are still available here: http://www.jose.it-berater.org/smffo...hp?topic=812.0
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.
Hi Petr,
here is the script. As you can see, it doesn't quite work like it should.
Cheers
Michael
Hi Mike,
I was converting exactly the same code .
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.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
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.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Looks good. Funny you worked on the same sources.
Bookmarks