Setbuffer where did it go?
BlitzMax Forums/BlitzMax Beginners Area/Setbuffer where did it go?
| ||
| Where did it go to my wee Barry Burtons? I remember arsing around with Blitz+ and being able to draw to the desktop by going Setbuffer(Desktopbuffer()) or something like that. Is that not achievable in BlitzMax GUI? What would Rebecca Chambers say? |
| ||
| Do a search for that topic |
| ||
| It's not achievable in BlitzMAX period. No such thing as imagebuffers. |
| ||
Oh yes there is, you can render to a texture!Function Render2Image(image:TImage) Local DXFrame:TDX7ImageFrame = TDX7ImageFrame (image.frame(0)) PrimaryDevice.Device.SetRenderTarget DXFrame.Surface,0 End Function Only thing is I have not had the time to get the handle to the backbuffer so I can change it back again :) So it's a one-way solution at the moment. |
| ||
| It's the price we pay for having hardware accelerated graphics in bmax. There are -very slow- ways to do it though. |
| ||
| it's stinky. One way haha. |
| ||
| what? |
| ||
| Just ignore him. =] Oh yes there is, you can render to a texture! Can we have an OpenGL version of that function as well, pretty please? ;] |
| ||
| It's the price we pay for having hardware accelerated graphics in bmax. There are -very slow- ways to do it though. = stinky Only thing is I have not had the time to get the handle to the backbuffer so I can change it back again :) So it's a *one-way* solution at the moment. = one way haha |
| ||
Oh I am so stupid muuuhhhhaaa.Strict Function Render2Image(image:TImage,frame:int=0) Local DXFrame:TDX7ImageFrame = TDX7ImageFrame (image.frame(frame)) PrimaryDevice.Device.SetRenderTarget DXFrame.Surface,0 End Function Function Render2BackBuffer() PrimaryDevice.Device.SetRenderTarget PrimaryDevice.backbuffer,0 End Function Switch it baby! {EDIT} Now with multiframe render :D |
| ||
Hmm, Tim have you got a simple example as I'm sure I have this wrong...
Strict
Function Render2Image(image:TImage,frame:Int=0)
Local DXFrame:TDX7ImageFrame = TDX7ImageFrame (image.frame(frame))
PrimaryDevice.Device.SetRenderTarget DXFrame.Surface,0
End Function
Function Render2BackBuffer()
PrimaryDevice.Device.SetRenderTarget PrimaryDevice.backbuffer,0
End Function
Graphics 640,480
Global myimage:TImage=LoadImage("max.png")
While Not KeyHit(KEY_ESCAPE)
Cls
If MouseHit(1)
render2image(myimage)
DrawRect 0,0,40,40
EndIf
render2backbuffer()
DrawImage myimage,0,0
Flip
Wend
|
| ||
Like I said I have not finished this yet, the above code will swap the target but I think there is something else that needs to happen, a bit like the old Renderworld command in B3D.Function Renderworld() PrimaryDevice.Device.EndScene() PrimaryDevice.Device.BeginScene() End Function Still don't work though. |
| ||
| Hey if you click in the window then the white square flashes up! |
| ||
| Yep, but it doesn't get saved as part of the image which is what I thought it would do. |
| ||
| Just figured how to do this. I'll post an example when it's working as it should. |