Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Can you render darkbasicpro 3d commands to BlueGUI canvas ?

Author
Message
B5Live
15
Years of Service
User Offline
Joined: 15th Feb 2009
Location: USA
Posted: 1st Mar 2009 03:06
Is there any example code to render darkbasicpro graphics to a BlueGUI canvas gadget ?

Brain Overload on programming.
tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 1st Mar 2009 07:00
Nope it's not capable of doing that. You can get canvas display into an image but you can't put an image on a canvas. Or the 3D render window if that's what you're after.

I'm not a real programmer but I play one with DBPro!
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 1st Mar 2009 11:13 Edited at: 1st Mar 2009 11:16
Yes you can, using the drawDot command and a memblock image / bitmap.
I wrote a short example of doing just a viewport canvas that displays the screen (bitmap 0).

Set your program to run in a 640x480 window if you run this:


As you see though, it takes far too long to be useful.
It could possibly be used to display a small 128x128 display of motion though, but that's about it.
And hey, why don't we have access to the bitmap data by default; making the memblock takes half the time needed to do this procedure

tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 2nd Mar 2009 23:01
When he said render I was assuming he meant 3D graphics. Maybe not.

Nice code snippet!

I'm not a real programmer but I play one with DBPro!
B5Live
15
Years of Service
User Offline
Joined: 15th Feb 2009
Location: USA
Posted: 3rd Mar 2009 00:36
What I meant was render all dbpro graphics commands to a canvas gadget for the purpose of mixing windows user interface gadgets with dbpro graphics output to a canvas gadget within a window.
There is a example in the Leadwerks 3d engine code for a model viewer utility Josh wrote in blitz basic, but thats for use with the Leadwerks engine.
I was just wondering if the same thing could be done in dbpro engine with say a pointer set to a canvas object.
Thankyou Rudolpho for very interesting example code.
I will keep looking for other ways if any to render to a canvas.

Brain Overload on programming.
Xsnip3rX
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: Washington State
Posted: 3rd Mar 2009 10:43
Yes you can B5Live, i've done it before

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 3rd Mar 2009 13:09
Thanks

I can guess that it would be possible to get to run at decent speed if one could find out a pointer to the screen data (which you can, using get pixels pointer()) as well as a pointer to the canvases image data (which I'm not too sure of) and then just copy the memory (copy memory) between them.

Xsnip3rX
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: Washington State
Posted: 4th Mar 2009 11:04
Personally, i'm making my own Editor/GUI :p



tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 4th Mar 2009 18:53
Quote: "Yes you can B5Live, i've done it before"

Prove it with some code because I've never seen DBPro graphics rendered to a canvas gadget and would like to see how it's done.

Quote: "What I meant was render all dbpro graphics commands to a canvas gadget for the purpose of mixing windows user interface gadgets with dbpro graphics output to a canvas gadget within a window."

You probably don't want to stick DBPro graphics in a gadget, per se. What you want to do is overlay the BlueGUI gadgets on top of the DBPro graphics window. By setting the camera viewport to certain coordinates and placing BlueGUI panel gadgets on the window you should be able to make it look like the graphics are in a gadget, but it will really be behind the gadgets.

I'm not a real programmer but I play one with DBPro!
B5Live
15
Years of Service
User Offline
Joined: 15th Feb 2009
Location: USA
Posted: 4th Mar 2009 21:18
That`s also a good idea I haven`t thought about
I was looking into the window's API for a way to transfer a bitmap
to a canvas gadget. Darkbasic help file said when you create a new bitmap all drawings are redirected to it. So if you had a pointer to a darkbasic bitmap and some window api function that could transfer that to a canvas. Blue GUI has a command to transfer a canvas to a bitmap, but I didn`t see one to transfer a bitmap to a canvas ?

Brain Overload on programming.

Login to post a reply

Server time is: 2024-04-19 03:10:35
Your offset time is: 2024-04-19 03:10:35