## Recommended Posts

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

##### Share on other sites
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?

##### Share on other sites
Quote:
 Original post by of_ownagehi:)i got 2 questions about directx.1) How can i detect if im in Scene, means if Device->BeginScene() wascalled? 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)

##### Share on other sites

Quote:
 Original post by feal872) 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).

##### Share on other sites
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

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628391
• Total Posts
2982419

• 10
• 9
• 19
• 24
• 11