Results 1 to 7 of 7

Thread: canvas, mix canvas draw routines on top of tbgl_ opengl commands

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

    canvas, mix canvas draw routines on top of tbgl_ opengl commands

    In a canvas that is assigned to tbgl, can I use a canvas draw function after I did some tbgl opengl drawing?
    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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Hi Kent,

    if you mean casting Canvas_* functions on TBGL render surface, than that is not possible. Some people combined GDI with OpenGL in the past, but with Vista/7 this is prohibied approach by MS.
    But what you can do, is to render image using TBGL, get the bitmap using TBGL_GetWindowBMP, save it to temporary file and load to UI canvas using Canvas_BitmapLoad.

    Or even simpler - as TBGL_GetWindowBMP returns BMP as string, just cut off the BMP header:


    s = TBGL_GetWindowBMP(hWnd, %TBGL_CLIENTAREA, width, height)
    (which is:
    s = [BMP file]
    )
    => is internally

    s = [Header][RGBXSeries]

    => cut off the header which is located on the beginning

    s = [RGBXSeries]

    => use Canvas_BitmapSet to UI canvas of same size

    Canvas_BitmapSet(s, width, height)


    I will provide example Kent, but I have something very important to perform tomorrow and need to prepare well today, so example will be posted most probably by tommorow evening.


    Petr

    P.S. Also do not forget TBGL has 2D primitives as well now, thanks to Mike, so it might be not necessary to use UI canvas
    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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Thanks Petr, work on your stuff. I was just wondering if it was doable.
    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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Hi kent, Petr
    i like the example TBGL_2D_primitives in the TBGL\Basic folder by Mike, it contains several good functions, point, line ,rect ,TBGL_NGon, the last one is interesting: in the doc: "With the vertex count of 3 you can draw triangles, with 4 squares, with 6 hexagons", 20 or more approximately circles, change the vertexCount to 6 and we will see a beautifull hexagon
    i think this example can be used as a basis for teaching geometry basics.
    for those who havn't tried it look at its picture with a moving heptagon (tbgl_ngon(x,y,60,7)):
    http://img43.imageshack.us/img43/201...primitives.png

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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Thanks for the link, I never saw that one or even that these new commands were in place. Nice additions to tbgl, thanks Mike and Petr.
    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

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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Hi Kent,

    did you have a look at the 2D functions? Are they what you need or do you want to investigate the TBGL->Canvas hack further?


    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

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

    Re: canvas, mix canvas draw routines on top of tbgl_ opengl commands

    Just looking around Petr at what all has been going on, no detailed hacking at the moment
    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. draw paint Demo (canvas) :)
    By Lionheart008 in forum UI (User Interface)
    Replies: 6
    Last Post: 27-11-2009, 00:08

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
  •