Results 1 to 5 of 5

Thread: TBGL FAQ ( Frequently Asked Questions )

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

    TBGL FAQ ( Frequently Asked Questions )

    TBGL FAQ
    Updated 19th of January, 2008

    This is list of solutions for quite common problems, I have splitted it to following categories to make search easier:
    • Frame rate and performance related
    • Texture related
    • Model related
    • Garbage collection

    If you think there is something missing please tell me


    Frame rate and performance related
    Q: How to measure performance of my app ?
    A: You can use built in statement to check framerate. To do this, just fill variable ( name it for example "FrameRate" ) from function once per frame:
    ' ...
    
    DIM FrameRate AS NUMBER
    while TBGL_IsWindow( hWnd)
    
     FrameRate = tbgl_GetFrameRate ' <-
    
     tbgl_ClearFrame
    
     ' -- Some rendering code here
     ' ...
    
     tbgl_DrawFrame
    
     ' ...
    
    wend
    

    Q: All my scripts run at 60FPS ( 75FPS ) and I cannot get higher even with very basic scenes
    A: Check your drivers and turn V-Sync ( vertical synchronisation ) to OFF.


    Q: All my scripts run at unbelieveable low speed, what can I do ?
    A: Please check this post, you have probably wrong drivers


    Q: As I get different FPS on different PCs, scene movements are faster/slower depending on computer
    A: It is good practise to keep all movements scaled to actual performance.
    • Create variable "FrameRate"
    • At beginning of frame add following line

    FrameRate = tbgl_GetFrameRate
    
    • Scale all calculations relative to FrameRate, for example to move ship by 5 m/s just add:

    Ship.X += 5/FrameRate
    

    Q: There are many ways to create geometry in TBGL, which one to use to get maximum performance
    A:
    • "immediate mode" - ( TBGL_BeginPoly / TBGL_EndPoly ) is best to get the idea, but also slowest one
    • "display lists" - for static geometry it is wise to cache using display lists ( see TBGL_NewList, TBGL_EndList, TBGL_CallList in help file )
    • "model buffers, display lists" - for best performance for dynamic meshes ( game charcters, monsters, water surfaces ) model buffers are the right solution right now. They are continuously optimized in each release of TBGL.
      For static geometry you can use model buffer too and than cache it using display lists. tbgl_m15DrawModel produces highly optimized GPU code, and it will even improve in future.



    Texture related
    Q: My texture looks weird!
    A: You probably try to use texture which is not power of two (POT) sided. To ensure maximum compatibility and performance use just POT textures.
    They can be both square sided ( 64x64, 128x128, 256x256, ... ) or rectangular ( 64x32, 512x64, ... )


    Q: I loaded TGA texture but polygon is still not textured right
    A: Make sure TGA is 32bit one - 24bits for RGB and 8bits for alpha



    Model related
    Q: I want to render points via model buffers
    A: Create model as usual, but set PSTOP flag only to last vertex.
    Make sure to call following function to make model look like points before rendering it:
    tbgl_PolygonLook %GL_POINT
    


    Garbage collection
    Q: Do I have to delete somehow display lists and textures from memory before my application ends ?
    A: No, it is done automatically.



    Hope this list can help to solve classic problems,
    Petr Schreiber
    Last edited by ErosOlmi; 07-05-2013 at 10:37.
    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

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

    Re: TBGL FAQ ( Frequently Asked Questions )

    Very nice Petr, a great idea to do this. I hope you add these to the next tbgl help.

    Something else that would be very useful and you already sort of did it is skeleton setups.

    1. Simplest, minimal code skeleton

    2. Simplest skeleton where user sets, light, camera, blending

    3. Like #2 but where the light, camera and blending could be modified with each drawframe

    and then versions of the above using the gl commands from the headers or mixed with tbgl and gl commands.

    One more thing to add to the QandA page, is what needs to be deleted by the user in tbgl. We used to have to delete display lists, but I know you wrote it is automatic now.

    Thanks again for this.
    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

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

    Re: TBGL FAQ ( Frequently Asked Questions )

    Hi,

    thanks, I will prepare it and update ASAP


    Bye,
    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

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by John Spikowski View Post
    Q. Where can I find the source to the TBGL extension DLL?
    TBGL is not open source. It is Free.

    Quote Originally Posted by John Spikowski View Post
    Q. What language is TBGL it written in?
    PowerBasic PB10x.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Thanks Eros - yes, I can confirm these are the correct answers.


    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

Similar Threads

  1. A few questions about the TBGL module
    By Bezumec in forum TBGL General
    Replies: 6
    Last Post: 22-06-2011, 10:43
  2. A few more questions..
    By oldpapa49 in forum thinBasic General
    Replies: 12
    Last Post: 21-03-2009, 21:45

Members who have read this thread: 1

Posting Permissions

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