kill camera
Blitz3D Forums/Blitz3D Programming/kill camera
| ||
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 |
| ||
Erm... if you've got two active cameras you're rendering everything twice? Delete one. |
| ||
thank yew... I thought as much!!! |
| ||
or just 'hide' one |
| ||
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 |
| ||
deleteentity or how about I just create the second camera with the first camera's variable name... that would do it yes??? RZ |
| ||
I don't get it... if you don't need 2 cameras, don't create 2 in the first place? |
| ||
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. |
| ||
yes freeentity |
| ||
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!) |
| ||
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. |
| ||
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 |
| ||
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... |
| ||
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 |