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.

DarkBASIC Professional Discussion / render to offscreen bitmap

Author
Message
Darklight
21
Years of Service
User Offline
Joined: 23rd Oct 2002
Location: United States
Posted: 6th Jan 2003 08:10
I'm probably just missing something very simple but is it possible to do something such as create a new bitmap and/or camera and render to that bitmap instead of the main image on the screen? I'm aware of doing 2D drawing on other bitmaps but how about 3D?
Darklight
21
Years of Service
User Offline
Joined: 23rd Oct 2002
Location: United States
Posted: 6th Jan 2003 08:55
OK I've been trying the 'Set Camera to Image' command with no luck at all. I keep getting an error to the effect of :
Runtime Error 504 : Cannot grab image due to illegal area at line 63 (or 87)

I don't even have a line 63 or 87!

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 6th Jan 2003 13:03
Look elsewhere for a GET IMAGE-like command...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 6th Jan 2003 13:46
Create Bitmap 1, Screen width(), Screen height()
Set Current Bitmap 1

Do your rendering stuff

Get Image 1, 0, 0, Screen width(), Screen height()
Set current bitmap 0

Paste Image 1, 0, 0

-------------------------------

I don`t know if this work.

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 6th Jan 2003 14:27
Try



Like the other 2D commands, the documentation doesn't specify a) whether the top left corner is 0,0 or 1,1 and b) it doesn't specify whether the end values are inclusive or exclusive...

I think for a) its the former and b) the latter.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Jan 2003 14:43
Correct In which case, your get image code will not include the last row or column of the display
firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 6th Jan 2003 17:58
Hmm, i tried to create a texture out of some 3d render and put the texture on a 3d object (that looks the same as the 3d render). But the result was kinda weird, the 3d object that i want to rotate doesnt rotate it seems like.
Check the weird result yourself.





ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 6th Jan 2003 21:57
I hace a real problem with the "get image" command

I think for sure it is buggy as all HELL

Your weird effect is because it copied a black screen to the cube.

Why doesn't this work?
rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 6th Jan 2003 22:47
When you sync, DB will render to the current Bitmap. If the current bitmap is 0, it will render to the screen. So create a bitmap the size of the screen, and set the bitmap to the new bitmap number. Then sync the screen, change the bitmap number to 0, and all your other stuff.

ICERGB- Your code copies a black bitmap to the image because you didn't sync.
Try something like this:



Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 6th Jan 2003 23:55
I GOT IT ))))) Wasn`t much to adjust, thanks ICERGB and rapscaLLion!!!

Here is the code:



I wonder if i could animate my texture so i could have spinning cubes on the surface of my spinning cube

firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 6th Jan 2003 23:59
Changed the backdrop colors for each bitmap so the cube is more distinct.



firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 7th Jan 2003 00:11
Extremely slow code, but it works in some way.
Any thoughts on how to do it in a much more efficient way?



ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 7th Jan 2003 02:53
Well I'll be...

Make me feel small
firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 7th Jan 2003 02:58
A small update (the hide/show object command wasnt correctly in my last code).

firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 7th Jan 2003 15:38
Ok, here is a code that is "smooth". Now the image is 256*256 in size and not the whole screen (less processing now). Enjoy the cube

firestarter
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: Norway
Posted: 7th Jan 2003 15:46
And ofcourse we can do it more stunning with allowing the cube to be mapped onto the cube that is mapped onto the main cube and so on. Cool effect ain`t it?

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 9th Jan 2003 19:31
Nice

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming

Login to post a reply

Server time is: 2024-05-24 18:49:05
Your offset time is: 2024-05-24 18:49:05