Results 1 to 10 of 10

Thread: Complete GLUT include file anywhere?

  1. #1

    Complete GLUT include file anywhere?

    Hi folks,

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

    Michael

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Complete GLUT include file anywhere?

    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

  3. #3

    Re: Complete GLUT include file anywhere?

    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?

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Complete GLUT include file anywhere?

    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

  5. #5

    Re: Complete GLUT include file anywhere?


    The translations that I did for PowerBSIC 8.+ are still available here: http://www.jose.it-berater.org/smffo...hp?topic=812.0

  6. #6

    Re: Complete GLUT include file anywhere?

    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.

  7. #7

    Re: Complete GLUT include file anywhere?

    Hi Petr,

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

    Cheers
    Michael
    Attached Files Attached Files

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Complete GLUT include file anywhere?

    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.
    Attached Images Attached Images
    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

  9. #9
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Complete GLUT include file anywhere?

    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.
    Attached Images Attached Images
    Attached Files Attached Files
    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

  10. #10

    Re: Complete GLUT include file anywhere?

    Looks good. Funny you worked on the same sources.

Similar Threads

  1. Include file for GDI/GPI+?
    By Michael Hartlef in forum General
    Replies: 4
    Last Post: 20-03-2010, 11:57

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •