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?
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
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.
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
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.
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
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 :good: