2 questions about DX

Started by
3 comments, last by of_ownage 14 years, 10 months ago
hi:) i got 2 questions about directx. 1) How can i detect if im in Scene, means if Device->BeginScene() was called? if i do it twice i get a error (cannot go in scene, if already) but how do i detect it like: if(InScene == false) Device->BeginScene(); ? 2) if i render a fullscreen pass with zwrite disabled to a render target can i do that without a depth surface or must i attach a depth surface with same dimensions? thank you guys :D
Advertisement
Your draw code should not depend on whether you are in "draw-mode" or not. It should just assume it, and you should simply get your codepath right:

draw_main () {    beginScene()    drawX()    drawY()    endSceneI()}


Simply assume inside your drawing functions that they are actually permitted to draw.


Or what is the strange reason that wants you to depend on such information?
Quote:Original post by of_ownage
hi:)


i got 2 questions about directx.



1) How can i detect if im in Scene, means if Device->BeginScene() was
called? if i do it twice i get a error (cannot go in scene, if already) but how do i detect it like:


if(InScene == false)
Device->BeginScene();
?


2) if i render a fullscreen pass with zwrite disabled to a render target can i do that without a depth surface or must i attach a depth surface with same dimensions?

thank you guys :D


1) Use a flag to determine if you are inside the BeginScene/EndScene block, even thought I don't know your reasoning, generally BeginScene/EndScene are called once per frame.

2) Yes, you can do that without depth stencil/Z Buffer attached. (I'm sure about DX10, i don't know for sure in DX9)
1. See this recent thread about it.

Quote:Original post by feal87
2) Yes, you can do that without depth stencil/Z Buffer attached. (I'm sure about DX10, i don't know for sure in DX9)
Yes, you only need a depth-stencil surface attached to the render target if you want to use it (in DX9).
2) ye thank i hoped so :D thats to confirm that


1) i set a flag now, if BeginScene() succeeded flag = true, if end scene i set it to false. thats crap, but it has to do something with executing a shader in lost device stuff and i have no idea how to do that better, in my normal rendering i only call it once in the render function but this is a exception :D


thank you for your help :D

This topic is closed to new replies.

Advertisement