kill camera

Blitz3D Forums/Blitz3D Programming/kill camera

Rook Zimbabwe(Posted 2005) [#1]
I created a camera earlier in my game and then created one later... does this use more vid or system memory? Two cameras instead of one???

Can I kill the other camera since I don't really need it?

RZ


GfK(Posted 2005) [#2]
Erm... if you've got two active cameras you're rendering everything twice?

Delete one.


Rook Zimbabwe(Posted 2005) [#3]
thank yew... I thought as much!!!


slenkar(Posted 2005) [#4]
or just 'hide' one


Snarkbait(Posted 2005) [#5]
You can toggle between two cameras like this:
;assuming bfore main loop:

camera1 = CreateCamera()

camera2 = CreateCamera()
CameraProjMode camera2,0 ;turn off camera 2


If KeyHit(57)
	CameraProjMode camera1,camtoggle
	camtoggle = 1 - camtoggle
	CameraProjMode camera2,camtoggle
EndIf



Rook Zimbabwe(Posted 2005) [#6]
deleteentity or how about I just create the second camera with the first camera's variable name... that would do it yes???

RZ


Snarkbait(Posted 2005) [#7]
I don't get it... if you don't need 2 cameras, don't create 2 in the first place?


Beaker(Posted 2005) [#8]
If you re-use the variable name you won't free the old camera and it will be memory lost forever. Amen.

Free it before creating a new one.


Rook Zimbabwe(Posted 2005) [#9]
yes freeentity


Damien Sturdy(Posted 2005) [#10]
This Isn't BlitzMax, there is no Garbage collector, so re-using a variable will not clear an object related to it.

(hell, I dont even know if max does that now!)


_PJ_(Posted 2005) [#11]

create the second camera with the first camera's variable name... that would do it yes???



No, the variable numerical value is like a memory address, so re-assigning the variable would just point to another memory address. The memory would still be used up with legacy data sat there taking up space and doing nothing.


Rook Zimbabwe(Posted 2005) [#12]
OK but... I use clearworld() after that intro screen... AND during the intro screen there are only two tris created (the sprite I .PNG to fade in to the intro...) and if I clearworld() and don't create the camera a second time I see nothing...

See what I mean... Clearworld() has gotten rid of all entities created (including camera and quite possibly light too!

RZ


Snarkbait(Posted 2005) [#13]
I still don't see any reason why you need to create two cameras. You can use the same camera from the intro for the rest of the program...


Rook Zimbabwe(Posted 2005) [#14]
I tried that... artifacts... I wish there was a way to flush out graphics card memory... STILL I am recoding and trying to figure out where I didn't clean it right! :)
RZ