Image does not exist???
Blitz3D Forums/Blitz3D Programming/Image does not exist???
| ||
Ok, I have a function generateTexture that returns an image handle. This code works :newimg%=generateTexture(1,1,1,"000255255","255000255","000255255","255000255","000255255","255000255") setbuffer frontbuffer() saveimage(newimg,"c:\temp\texture_test.bmp") However, this doesn't : newimg%=generateTexture(1,1,1,"000255255","255000255","000255255","255000255","000255255","255000255") setbuffer frontbuffer() print "something" saveimage(newimg,"c:\temp\texture_test.bmp") The saveimage line throws a "Image does not exist" error. The only difference between the two pieces of code is that the second one has a print statement before I save the image. Isn't that odd? I really don't understand this. Any ideas? |
| ||
Hmmm... how come I always find what I'm looking for right after posting? Apparantly, the print command sets the graphics mode since it hasn't been set yet, clearing all images (or at least, that's what I think is happening). Since this was just a test program, I didn't have a Graphics or Graphics3D command, but if I put it on top of the program, it does seem to work. |
| ||
Its hard to say, as you haven't included the code for the two functions that make up 66% of the code above. One things for sure though - 'Print' definititely does *not* set any graphics mode. Your default graphics mode (unless you specify otherwise) is a 400x300 2D window. |
| ||
Try using the Text comand rather than print. |
| ||
Try for yourself. You don't need that 66% of the code, just try these two : This one should give an "image does not exist" : a=CreateImage(500,600) Print "test" DrawImage a,0,0 The second is the same but I commented out the print statement. It should work fine. a=CreateImage(500,600) ;Print "test" DrawImage a,0,0 |
| ||
I am not sure what you are trying to do here, but it looks like you want to create an image with a statement in it. Someone will hopefully correct me if I am wrong but I believe print is a console command and text is a directx command, so if you are using directx for an image wouldn't it make sense to use text? |
| ||
I didn't have a Graphics or Graphics3D command, but if I put it on top of the program, it does seem to work Yes, it's fairly logical - graphical commands should be used after the graphics/graphics3D command and before endgraphics, otherwise you're just asking for unnecessary problems. |
| ||
Who doesn't make a program without Graphics/Graphics3D at the top?!? |
| ||
I am not sure what you are trying to do here, but it looks like you want to create an image with a statement in it. Someone will hopefully correct me if I am wrong but I believe print is a console command and text is a directx command, so if you are using directx for an image wouldn't it make sense to use text? Firstly, the "just try it yourself" post was meant as a reply to GfK's post. You just happened to post while I was typing this :)but to answer your question : I'm not trying to print to the image, I was creating some images with a function, this function returned the image handle, but if I printed something (to the screen, not the image) before saving the image, it didn't work and I found this rather odd. Calling graphics or graphics3D will clear all open images (I believe), but if you don't call these, a print-command apparantly does the same. |