CreateImage problem =(
BlitzMax Forums/BlitzMax Programming/CreateImage problem =(
| ||
Erm my image does not show????Graphics 640,480,0,32 image=CreateImage(256,256) LockImage(image) SetColor 255,0,0 ; DrawRect 0,0,128,128 UnlockImage(image) Repeat ; Cls DrawImage image,0,0 Flip ; Until KeyDown(KEY_ESCAPE) ; End |
| ||
I'm pretty sure you can't use the drawing commands such as DrawRect when the image is locked. In Blitz3D at least, the only commands you can use on a locked image are WritePixelFast and ReadPixelFast. |
| ||
well it looks like you can but only when you take off the CLS. |
| ||
The DrawRect command is in fact drawing to the current buffer not the locked image and when you remove cls it no longer wipes the current buffer and so displays. (And because you are using windowed mode, there is only one buffer so it does not flicker). |
| ||
So do I use pixmaps for making simple images in code? |
| ||
Yes, you do and then convert to an image when you've finished. |
| ||
If you get into OpenGL you can use glCopyTexSubImage2D to grab from the backbuffer straight into an existing texture. |
| ||
...or use 'GrabImage'. The thing is, OpenGL doesn't really have a (dependable) mechanism for rendering directly into textures, so 'SetBuffer ImageBuffer' style behaviour sort of goes out the window. There is a new OpenGL extension out that addresses this, so in future...maybe... |
| ||
wow a reply from God him self ;).... i fell all special now. |