Creating an image without drawing anything.

BlitzMax Forums/BlitzMax Programming/Creating an image without drawing anything.

Thareh(Posted 2009) [#1]
Hi,
I'm creating a GUI for my game and I want each window to just be an Image put together using DrawRect, DrawText etc. But the problem is that I don't want to draw ANYTHING on the screen, not even a little flash to create this image.
So I can't simply draw the whole thing, capture it and then use the image.
I also can't pre-render everything because the UI is very dynamic.
Anyone got any ideas? :)

Thanks!


Gabriel(Posted 2009) [#2]
So I can't simply draw the whole thing, capture it and then use the image.

Yes you can. Nothing is seen until you flip the buffers. If you cls after drawing and before flipping the buffers, nothing is ever seen, "not even a little flash".


Brucey(Posted 2009) [#3]
Render to texture? :-)


ImaginaryHuman(Posted 2009) [#4]
I agree with Gabriel, nothing to stop you drawing stuff on the backbuffer and clearing it and then drawing your normal screen before you flip.


Thareh(Posted 2009) [#5]
Okey, But I'm drawing alot of other stuff, and this kinda comes in the middle of it. I don't want to CLS the other stuff, and then capture the things I want to capture. How would I go ahead and do this? :O

Thanks! :)


andy_mc(Posted 2009) [#6]
***edit: sorry thought this was a b3d question****


_JIM(Posted 2009) [#7]
As Brucey said:


Render to texture? :-)



I can't remember the locations now, but I remember Indiepath did something related to RTT, and there was someone else who had a module with 3 ways to RTT.

Sorry to say this, but do a bit of searching on the subject :) ("RTT" or "Render to texture")


Thareh(Posted 2009) [#8]
Okey great, I'll do some searching ;) Thanks!


xlsior(Posted 2009) [#9]
One thing to keep in mind: RTT doesn't work on -all- video cards, you may run into issues with some of the old / low-end ones.


beanage(Posted 2009) [#10]
hey.. um.. hardware render to texture is one way, but its sorta complicated if u have never heard of it until now..

my suggestion:

|-------
r |1. draw the stuff thats supposed to be visible (e.g. a progressbar)
e |2. fip
p |3. draw your window or what u want to have pseudo-rtt'ed
e |4. GrabImage(..)
a |5. cls
t |6. Update your progress bar
|7. flip
|-------

if u want to do real rtt, FBOs would be the way to go, wouldnt they?


Mr. Write Errors Man(Posted 2009) [#11]
GrabImage doesn't support alpha values. Theoretically you could use Pixmaps.