SetBuffer BackBuffer()?

BlitzMax Forums/MiniB3D Module/SetBuffer BackBuffer()?

RustyKristi(Posted 2016) [#1]
Probably asked this a lot of times, but coming from Blitz3d, what is the equivalent of SetBuffer BackBuffer()?

I can only find this and it is with DX and 2D..
http://www.blitzmax.com/Community/posts.php?topic=53056

Just curious if this is needed in OpenB3D/MiniB3D.


markcw(Posted 2016) [#2]
There's no need for this in OpenGL. I'm sure Angros will have a good technical explanation. :)


RustyKristi(Posted 2016) [#3]
HaHa! no need munch, thanks a lot for confirming this anyway. :D


angros47(Posted 2016) [#4]
Actually, OpenB3D draws by default on backbuffer, so there is no need to explicitly set it. If it were drawing on front buffer, there would be no need for the flip command, after all.

Anyway, in Blitz3D the command "SetBuffer" was used for many purposes:

-switch between front and back buffer (allowing the usage of double buffer); drawing directly in the front buffer sometimes caused annoying flickering, so almost everyone used the back buffer. In OpenB3D, as said, you start already in back buffer, anyway if for some reason you need to use the front buffer, there are opengl commands that set it (so, there was no point in duplicating them)
-setting the buffer of a 2d image, to draw on it: it was useful in BlitzBasic 2d (where the command SetBuffer has been introduced), and in Blitz3d in 2d mode. Since OpenB3D is for 3d only, it has no support for 2d images, and lacks 2d drawing command (so, there is no point using SetBuffer for that).
-setting a texture buffer, to draw on a texture: this was indeed useful, but incomplete in Blitz3d, because only 2d commands could be used on a texture: there was no way to perform a RenderWorld on a texture, the only work around was to render on the back buffer and copy on the texture. In OpenB3D, it's possible to directly render on a texture with CameraToTex. There is still no way to use 2d commands on a texture, because OpenB3D has no 2d commands, but it's possible to use 2d commands of another graphic library on a buffer, and then use the buffer to create a texture with the command "BufferToTex". So, even in this case, there is no point in implementing a SetBuffer command, since more efficient commands are already available.


RustyKristi(Posted 2016) [#5]
Great info angros47, thanks for these details.

 but it's possible to use 2d commands of another graphic library on a buffer, and then use the buffer to create a texture with the command "BufferToTex". 


Awesome, I thought I was getting used to engine/framework incompatibilites so this is just awesome! :D


RemiD(Posted 2016) [#6]

There is still no way to use 2d commands on a texture, because OpenB3D has no 2d commands, but it's possible to use 2d commands of another graphic library on a buffer, and then use the buffer to create a texture with the command "BufferToTex"


has anybody managed to do that and is it as fast (or faster, or slower) than writing on a texture with Blitz3d ? Because personally i often need to create/modify textures...