Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: NeHe Lesson09

  1. #1

    NeHe Lesson09

    NeHe Lesson09 will Draw 50 Stars on the Screen and Rotate them.

    Keyboard Controls...

    'T' - Toggle Twinkle

    Cursor Key Up - Decrease Tilt
    Cursor Key Down - Increase Tilt

    'PgUp' - Zoom Out
    'PgDn' - Zoom In

    Update...
    This is the New Download which is much faster than the Original.

    Update...
    This is the New Version which includes a Keyboard Handling Routine to detect if a Key has been Released or not.
    Attached Images Attached Images
    Attached Files Attached Files
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

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

    Re: NeHe Lesson09

    Hi Mathew,

    this was always my favourite lesson

    It seems glColor4ub is a bottleneck on my PC, what about TBGL_ColorAlpha instead of it ?
    Maybe there is something wrong with my box, but using the glColor4ub I will get 12 FPS, with TBGL_COLORALPHA 80 FPS... That's quite noticable difference

    When I use display lists I can get to 103 FPS.

    Mathew, in my head grows evil idea - when you will finish your work on NeHe conversion, what about making "extreme edition" of each lesson ( well, #1 hard to beat ). It would show how to get maximmum possible performance while getting the same result via TBGL commands.

    What do you think ?


    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

  3. #3

    Re: NeHe Lesson09

    Hey, good idea I thought it was a bit slow. :P

    It never occurred to me that I could have used 'TBGL_ColorAlpha' instead of 'glColor4ub'.
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

  4. #4

    Re: NeHe Lesson09

    Cool Matthew, thank you!

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: NeHe Lesson09

    Matthew,

    fantastic example but for some reason it is very slow.
    I suppose the bottleneck is calling glColor4ub using a declare external statement compare with native module functions.
    I need to have a look at calling dll functions. I should get more speed on this process.

    In the meanwhile, I attach a demo from my library of thinBasic examples that maybe can give some idea on how to avoid using external dll functions calling.
    Imagine who is the author?

    Eros
    Attached Files Attached Files
    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

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: NeHe Lesson09

    Using TBGL_ColorAlpha is 10 times faster.
    I need to have a look at dll calling :-[
    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

  7. #7

    Re: NeHe Lesson09

    Quote Originally Posted by Psch
    Mathew, in my head grows evil idea - when you will finish your work on NeHe conversion, what about making "extreme edition" of each lesson ( well, #1 hard to beat ). It would show how to get maximmum possible performance while getting the same result via TBGL commands.

    What do you think ?
    Anything that makes them go faster is fine with me.

    @MikeHart - Thank's, Mike.

    @ErosOlmi - I think I know who the Author is.

    Update...
    I've just tried changing the colour Command to TBGL_COLORALPHA.

    It runs just as fast as the Original C++ version.

    The new version has been uploaded.

    That Particle Tornado Demo looked really good.

    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

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

    Re: NeHe Lesson09

    Hi,

    thanks for updating it
    Tornado ? 90 lines of code... could be optimized too


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

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

    Re: NeHe Lesson09

    Geat come home and another cool lesson is finished and a neat demo from Petr too.

    Thanks guys!
    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

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: NeHe Lesson09

    Did I say I had to check some code on dll functions calling?
    So, I did it and found a weird bug on internal hashing storing. I was adding into an hash table the open DLL handle over and over and over ...

    I amended thinCore and now Lesson09 using 'glColor4ub' originally executing at 35 FPS on my machine is executing at 240 FPS !!!!
    So almost 8 times faster. This will speed up all script using external dll functions.
    This fix will be present in next release.

    Try to execute original Lesson09 using 'glColor4ub' and see the difference.

    So thanks to all.
    Eros

    ADDED: thinCore.dll removed from this post because included into thinBasic preview version 1.3.0.1
    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

Page 1 of 2 12 LastLast

Similar Threads

  1. NeHe lessons
    By Michael Clease in forum TBGL General
    Replies: 1
    Last Post: 26-06-2008, 13:24
  2. NeHe Lesson 01
    By matthew in forum TBGL Tutorials
    Replies: 1
    Last Post: 16-03-2007, 06:38
  3. More NeHe Lessons...
    By matthew in forum TBGL Tutorials
    Replies: 5
    Last Post: 15-03-2007, 22: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
  •