Sorry if someone has already reported the solution, but the reason you get the object not exist is because when the video card is forced to flush its resources, DBP removes all the objects/images/bitmaps that relied on those resources as well. You can detect this event by using the SCREEN INVALID command, which when set to one indicates the windows desktop has caused the video card and DBP to flush its resources. The modfieid code below resolves this problem:
sync on
sync rate 30
set window on
set display mode 640,480,32
make object cube 1,3
do
rotate object 1,object angle x(1)+.5,object angle y(1)+.5,0
sync
if screen invalid()=1
if object exist(1)=0
make object sphere 1,3
endif
endif
loop
This has been reported as a bug by some users, but to build the reconstruction of resources as an automatic feature of the language would be a nightmare task. The language allows users to modify the resources in many ways, and they are not always saved in system memory in the event the video memory is flushed. The best course of action is to either prevent the user from switching away from your application, or provide a friendly prompt to the user if this event occurs. If the application is data critical, you are still able to save out data in the normal way, only the objects and other video memory based resources have been cleared. If you want to emulate how top games handle this event, then you must reconstruct the entire applications visual resources after such an event, which means reloading and preparing all your objects, images and bitmaps, etc. An ideal way to do this is creating a subroutine or function which is soley responsible for (a) creating and (b) destroying all your video memory based resources. This third approach ensures that when you resize the desktop, toggle to administrator windows, fast user switch or hit an admin screensaver, your application not only survives, but restores itself to its former state. This technique is best used in title screens where changing the resolution can be performed, and the title graphics reloaded without interuption.
"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all
"