Sign in to follow this  
of_ownage

2 questions about DX

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 this post


Link to post
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 this post


Link to post
Share on other sites
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)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this