Jump to content
  • Advertisement
Sign in to follow this  
of_ownage

2 questions about DX

This topic is 3464 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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?

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
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).

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!