Results 1 to 4 of 4

Thread: Cool and Clean, safe to use?

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Cool and Clean, safe to use?

    I was experimenting today and tried out the templates in thinAir when creating a new project. Really nice job Eros and Petr on those templates!

    After awhile, I used the tbgl skeleton template and started changing, well seeing what I could get away with. This runs fine and bundles fine too to an exe file.
    Is it safe to code in this style these days even though it works fine in latest thinBasic?

    Uses "TBGL" 
    
    ' Create and show window
    DWord hWnd = TBGL_CreateWindowEx "TBGL script - press ESC to quit", 640, 480, 32, 
                                %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX
    TBGL_ShowWindow 
    
    ' Initialize lighting
    TBGL_UseLighting %TRUE
    TBGL_UseLightSource %GL_LIGHT0, %TRUE
    
    TBGL_SetLightParameter %GL_LIGHT0, %TBGL_LIGHT_POSITION, 15, 10, 15, 1 
    
    ' Resets status of all keys 
    TBGL_ResetKeyState
    
    ' Main loop
    While TBGL_IsWindow hWnd   
        TBGL_ClearFrame 
        TBGL_Camera 15, 15, 15, 0, 0, 0 
        
        TBGL_Color 255, 128, 0 
        TBGL_Box 1, 1, 1 
        
        TBGL_DrawFrame 
        ' ESCAPE key to exit application
        If TBGL_GetWindowKeyState hWnd, %VK_ESCAPE Then Exit While   
    Wend 
    
    TBGL_DestroyWindow
    
    Last edited by kryton9; 04-05-2017 at 21:23.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

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

    Regarding those states, hmm... I tend to use the push/pop style, as it is more maintainable.
    You can read about the concept here: State-safe-TBGL-programming.

    Also - for building scene in more structured way, I kind of like the Scene based syntax maybe a bit more, as demonstrated by TBGL_EntitySkeleton template.

    Plus... maybe I would wrap the code in function TBMain().

    Templates are another part of thinBASIC which could be maintained at gitHub, so we could keep them fresh better


    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
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    Thanks Petr, will check out the template you recommended next.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    thinBasic Bundle, excellent

    I really love how nicely thinBasic bundle to an executable works. I am happy to report that my small test bundled to 410K.

    For comparison using Processing and doing a similar bundle export without Java embedded comes out to over 4MB

    With Java embedded, which would be a fairer comparison to thinBasic bundle, it was near 67MB!
    Last edited by kryton9; 07-05-2017 at 11:04.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Article: State safe TBGL programming
    By Petr Schreiber in forum vBCms Comments
    Replies: 1
    Last Post: 26-10-2012, 19:04
  2. StromekVFX - new, clean edition of old tree generator
    By Petr Schreiber in forum TBGL Random Trees
    Replies: 20
    Last Post: 03-03-2009, 18:46
  3. clean(ish) Energy
    By Michael Clease in forum Science
    Replies: 12
    Last Post: 20-10-2008, 19:37
  4. C++ nice and clean tutorial
    By ErosOlmi in forum C / C++
    Replies: 8
    Last Post: 16-01-2008, 17:04
  5. Replies: 0
    Last Post: 18-07-2007, 08:37

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
  •