Advertisement

Mixing DD and D3D

Started by March 16, 2000 05:49 PM
13 comments, last by Rasta 24 years, 11 months ago
Potsticker, I've had the same problem, but only in windowed mode. No matter where call the Blt or BltFast function (usually after the map is drawn and endscene is called), it never shows on screen (although I believe that the Blt functions actually return a fail code). If I switch to fullscreen mode, both Blt and BltFast work great.

For anyone who has gotten this to work in windowed mode, I'd really appreciate it if you could send me some source code, so I can see where my mistake may be.

Houdini
rgeiman@flashcom.net

Edited by - Houdini on 3/17/00 2:02:32 PM
- Houdini
!!
In DirectxSDK there is said, that for performance reasons you should avoid mixing 2d and 3d operations, so rendering two triangles at near z clipping distance with cockpit image as a texture should generally be much faster. if you need any changing graphics ( gauges, stuff like that) try creating texture as a system memory surface, render cockpit image on it, and then as a last operation before closing the scene render 2triangles. It should still be faster than blt. in SDK there is also info how to get precise texel-pixel mapping, so every texel covers one pixel on render target.
(i havent tried blt on d3d render target myself, so i dont know if its really any faster or not, but im using aforementioned technique to get half-transparent cockpit)

-kertropp
-kertropp C:Projectsrg_clueph_opt.c(185) : error C3142: 'PushAll' :bad ideaC:Projectsrg_clueph_opt.c(207) : error C324: 'TryCnt': missing point
Advertisement
I think you''re right about that Kertropp, but it gets tricky when you need big surfaces/textures. I''ve heard that D3D gets a big performance drop with any textures bigger than 256x256. Not that I notice it, but I do have a Geforce card too...

I''m going to use a DirectDraw tile function to draw a map and D3D to create effects like fog, explosions, clouds and so on. I''m just worried it won''t be such a good combination. But using D3D drawing tiles would be hard, since my tile surfaces are 640x480, they won''t make good textures.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
If the worst comes to the worst, use TLVERTEX (ie. ones in which you specify the final destination) rather than messing with the Z value to place your D3D triangles. Textures above 256x256 (or even around that) cause problems - but nothing stops you from splitting the image into more than one texture if its reasonably static. For that matter, with modern rendering speeds, you might as well use a few trianges to include all the elements of your UI.
I don''t know much about D3D yet, but I believe that is exactly why the D3D render target is also a DirectDraw surface -- so you can treat it as both a render target and a drawing surface. There may be a few IDirectDrawSurface function calls that you have to watch out for while you''re in the BeginScene()/EndScene() functions.

Although I''m a beginner, I wouldn''t think there''s anything to worry about -- rendering 3D is a one-way operation. After it''s plotted the pixels, D3D doesn''t care what you do with the surface. It uses math to figure out where to place things and how to shade; D3D doesn''t need to read the pixel data of a surface to see how it turns out. (That''s your job )

Check out the SDK for the functions you want to use -- if there''s a NOTE: Cannot use certain D3D functions while... or an DDERR_CANNOTUSED3DWHILE... or something obvious like that, I wouldn''t use it then. If you look hard, and there isn''t an obvious note in there, I''d use it. The SDK writers wouldn''t leave out something that important!

Good Luck!


- null_pointer

This topic is closed to new replies.

Advertisement