Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 40

Thread: FBGFX module for thinBasic, to handle 2D graphics

  1. #11

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Hi,

    thanks Eros. That might be better to do some of those functions straight to the module.
    I still made it go faster (smaller loop):
    [code=thinbasic]'Plasma-like effect with FBGFX
    uses "FBGFX"

    Dim w,h As Double
    w=200
    h=150

    FBGFX_ScreenRes(w,h,32,2)

    Dim x,y,page As Double
    Dim c,t As Double

    while FBGFX_InKey() <> "q" 'Program runs until "q" is pressed
    t=t+1
    For x = 0 To w step 3
    For y = 0 To h step 3
    c= (Sin((x+y+t)/100)+Cos((x-t)/100)+Cos((y-t)/100)+Cos((x-y+t)/100))*2+Sin(t/100)*15
    FBGFX_Color(Rgb(Sin(c)*64+128,Cos(c)*64+128,Cos(-c/2)*64+12, 0)
    FBGFX_Circle(x,y,3)
    Next
    Next

    'pageflip
    page=-page+1
    FBGFX_Sync(1)
    FBGFX_ScreenSet(page,-page+1)

    wend[/code]

    Also you guys can suggest some functions that I'll put to the module.

    Thanks everyone,
    misthema.
    ¯\_†_/¯º¯¹¯²¯³¯\_†_/¯³¯²¯¹¯º¯\_†_/¯

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

    Re: FBGFX module for thinBasic, to handle 2D graphics

    eh
    smaller loops are a trick. But I'm sure that with module functions you will get some real boost.

    The key point to decide to have a module function is if that function can be enough general to be used also in other scripts.
    If yes, than go with module function. You will have a better module and faster scripts.

    Ciao
    Eros
    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

  3. #13
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159

    Re: FBGFX module for thinBasic, to handle 2D graphics

    change from double to single you dont need the precision should make it faster.

    If you want some ideas just google 2d librarys and see what they do and recreate them.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

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

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Hi,

    I created new thread for assembler optimization of plasma code, to not break high-level structure of samples in this thread.
    I did first optimization of one expression, just 1.3-1.5 faster - not bad sign for thinBASIC parsing engine .

    But it gives me 3FPS instead of 2, which is thing many would die for ... or at least someone ... hey ... anyone ?


    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

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

    Re: FBGFX module for thinBasic, to handle 2D graphics

    And here my version with an external DLL written in Power Basic implementing the two functions I mentioned.
    I get a speed incremented by 3/4 times the original speed.

    Ciao
    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. #16
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Cool demo Petr and Eros. The one in Eros's post is significantly faster than the copy and paste one from Petr's. In both however, I can't close the window in any standard way and have to use the TaskManager to kill the running app.

    Other than that, those kind of nice smooth color changes always impress me!
    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

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

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Kent,

    you have to press "q" key to close the window.
    You can get it from the main WHILE/WEND loop.

    Ciao
    Eros
    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

  8. #18

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Quote Originally Posted by kryton9
    In both however, I can't close the window in any standard way and have to use the TaskManager to kill the running app.
    I have to use the "q" key, becouse I haven't figured out how can I use ESCAPE in FBGFX_InKey function. Maybe I'll make it work with scancodes and make equates for them.

    Bye,
    misthema.
    ¯\_†_/¯º¯¹¯²¯³¯\_†_/¯³¯²¯¹¯º¯\_†_/¯

  9. #19

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Thank for this module. Is there a way to make it work with thinBasic windows?

  10. #20

    Re: FBGFX module for thinBasic, to handle 2D graphics

    Michael,

    I don't think so, becouse FBGFX creates its own window and viewport where it draws everything.
    Or did I miss what you ment?

    Bye,
    misthema.
    ¯\_†_/¯º¯¹¯²¯³¯\_†_/¯³¯²¯¹¯º¯\_†_/¯

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. module to handle 2d plus more
    By Michael Clease in forum Experimental modules or library interface
    Replies: 2
    Last Post: 13-01-2008, 10:56

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
  •