Setbuffer where did it go?

BlitzMax Forums/BlitzMax Beginners Area/Setbuffer where did it go?

Makepool(Posted 2005) [#1]
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?


ImaginaryHuman(Posted 2005) [#2]
Do a search for that topic


Hotcakes(Posted 2005) [#3]
It's not achievable in BlitzMAX period. No such thing as imagebuffers.


TartanTangerine (was Indiepath)(Posted 2005) [#4]
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.


Ferminho(Posted 2005) [#5]
It's the price we pay for having hardware accelerated graphics in bmax. There are -very slow- ways to do it though.


Grey Alien(Posted 2005) [#6]
it's stinky. One way haha.


Dubious Drewski(Posted 2005) [#7]
what?


Hotcakes(Posted 2005) [#8]
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? ;]


Grey Alien(Posted 2005) [#9]

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


TartanTangerine (was Indiepath)(Posted 2005) [#10]
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


tonyg(Posted 2005) [#11]
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



TartanTangerine (was Indiepath)(Posted 2005) [#12]
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.


TartanTangerine (was Indiepath)(Posted 2005) [#13]
Hey if you click in the window then the white square flashes up!


tonyg(Posted 2005) [#14]
Yep, but it doesn't get saved as part of the image which is what I thought it would do.


TartanTangerine (was Indiepath)(Posted 2005) [#15]
Just figured how to do this. I'll post an example when it's working as it should.