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 / Rendering to a texture...

Author
Message
LastOfTheBedroomCoders
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: United Kingdom
Posted: 9th Oct 2002 11:33
Hi all,

I'm trying to use "set camera to image" on a 32Mb GeForce2 GTS, but all I get is random texture data. Is this down to my dodgy coding (see below), or is it a lack of functionality on the GeForce?

>>>


sync on

rem // MAKE THINGS
make object box 1, 10,10,10
make object sphere 2, 15

rem // SET UP NEW CAMERA
make camera 1
clear camera view 1, RGB( 255,0,0 )
point camera 1, 0,0,0
position camera 1, 30,30,30

rem // PLACE OBJECTS
position object 1, -10,0,0
position object 2, 10,0,0


rem // RENDER
do

rem // SHOW CAMERA 1 ON BOX?...
set current camera 1
set camera to image 1, 1, 256,256
texture object 1, 1

rem // BACK TO ORIGINAL CAMERA AND MOVE
set current camera 0
control camera using arrowkeys 0, 1, 1

rem // UPDATE
sync

loop
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 9th Oct 2002 12:30
I get that problem with my Geforce 2 mx 400 32mb. If you replace the 'BACK TO ORIGINAL CAMERA AND MOVE' section with



then move the camera backwards you should see the objects appear on the texture. However the texture never clears, so you just see lots of camera images overwriting one another. I get all the random data appearing, but if you use a moving image then it's easier to see what's going on. If you use a scene that is filled with polygons (no gaps) then the camera image should work properly. Here's a rehash of your code to demonstrate:



Now I'm late for school...
LastOfTheBedroomCoders
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: United Kingdom
Posted: 9th Oct 2002 16:41
Nice 1 Darthster! Works a treat!

I think I've sorta sussed what's going on here - when you make extra cameras, they don't automatically get set-up as you might expect. And there may be (Shhh!) a bugette or two in the camera code... Roll on patch 2!

I'm still experimenting, but to cure the "camera never clearing" prob, just explicitly set the backdrop on for any new cameras - i.e. "backdrop on 1" (or use your own skydome-type-object as they recommend in the manual!)


Onwards and upwards...

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 9th Oct 2002 17:52
Glad to have helped. Thinking about that gave me a better understanding of the camera code, so I can use cameras properly! Expect another 20 liner coming soon!
Zed
21
Years of Service
User Offline
Joined: 20th Sep 2002
Location:
Posted: 9th Oct 2002 22:25
I get no problem at all with multiple cameras. I think the thing you're missing is 'set backrop on camera_no' and 'color backdrop camera_no' this will clear the video memory used for the new camera.

Well it works for me anyway.

Login to post a reply

Server time is: 2024-04-24 23:48:35
Your offset time is: 2024-04-24 23:48:35