I've been creating a little particle editor and I wanted to add a feature where you can save a animation strip of the effect with all alpha info etc. After searching the forums here for clues I got as far as saving it ok except it's just not quite right, like the image it's saving isn't as opaque as it should be. The below code demonstrates the problem:
Basically that should draw a few ovals grab it as a pixmap then load that as an image and draw it to the right to compare. How it appears on the right is how it saves too and as you should see it's not grabbing the image properly somehow.
Hopefully it's something simple but any ideas would be greatly appreciated!
SetGraphicsDriver GLMax2DDriver() Graphics (1000, 500,,, GRAPHICS_ALPHABUFFER) SetClsColor2 0, 0, 0, 0 Cls SetBlend ALPHABLEND SetAlpha.5 SetColor 255, 0, 0 For Local c:Int = 1 To 255 Local size:Int = Rnd(50, 125) SetColor c, 0, 0 DrawOval Rnd(100, 300), Rnd(100, 300), size, size Next SetAlpha 1 SetColor 255, 255, 255 Local pixmap:TPixmap = GrabPixmap(0, 0, 500, 500) 'SavePixmapPNG(pixmap, "test.png") Local testimg:TImage = LoadImage(pixmap) DrawImage testimg, 500, 0 Flip WaitKey Function SetClsColor2(red, green, blue, alpha = 255) glClearColor red / 255.0, green / 255.0, blue / 255.0, alpha / 255.0 End Function
Basically that should draw a few ovals grab it as a pixmap then load that as an image and draw it to the right to compare. How it appears on the right is how it saves too and as you should see it's not grabbing the image properly somehow.
Hopefully it's something simple but any ideas would be greatly appreciated!