how to combine 2d and 3d ?

Blitz3D Forums/Blitz3D Beginners Area/how to combine 2d and 3d ?

b32(Posted 2006) [#1]
As I understood, it is not recommended to combine 2d and 3d in the same application, because it could cause a slowdown in your application.
However, when I draw onto a texture, I would still use the 2d commands, such as Rect/DrawImage/CopyRect.
What commands can or can't I use ? Should I avoid all these 2d commands and figure something out with Animated Textures/TextureCoordinates ? Or is it enough to avoid using images and use textures instead ?


Ross C(Posted 2006) [#2]
I think it's the actual drawing using 2d commands, to the screen buffer, that causes the biggest slowdown. Dunno for sure though. Maybe do some test's between writing to the screen buffer and writing to the texture buffer/image buffer. I'm sure there is a speed difference.


Sledge(Posted 2006) [#3]
I don't think anyone has ever reported having one of these phantom computers that totally fails to cope with 2D & 3D commands on the same frame. Even my deliberately low-spec laptop is unfazed by this sort of thing. It's a non-issue.


What commands can or can't I use ?


Print and Write. They're slow, full stop. If you're going to do texture work then give the user the chance to decide whether those textures should be held in Vram or not... from what people have posted in the past, which happens to be the faster depends on the machine and drivers in question. (Personally I have always gotten better performance from holding 'em in vram.)


Stevie G(Posted 2006) [#4]
Agree with Ross C. Drawing to a texture has never given me any issues. Drawing text to the backbuffer has though. Slower than a week in the jail if you have alot getting printed! ;)

Stevie


jfk EO-11110(Posted 2006) [#5]
Personally I have never seen text slowing down the machine that much. Maybe you guys are talking about 800 fps dropping to 300 fps. But basicly it won't drop in a linear way: the more text the slower - or something. I don't think you need 800 frames, do you?

However, drawing to a texture is a nono. It turned out there's a number of machines (maybe 10% or so) that won't support direct 2D drawing to a texturebuffer, but MAV out.

Therefor you have to
-draw to backbuffer
-copyrect from backbuffer to texturebuffer

The topic title is "how to combine 2d and 3d ?"

OF course you can do that. Use the command CameraClsMode to stop RenderWorld() from erasing the background. This way you can EG:
-Draw a 2D background
-Render some meshes over it
-Draw some 2D masked images ontop
-finally render some FX

But maybe you should think about to use Pseudo 2D. This technic will use sprites for all 2D images. They allow to use hiq antialiased contours based on alpha transparency, compared to true 2D that has always blocky pixel contours. There are some ready to use pseudo-2D libraries.