Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

state change in dx

This topic is 4670 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

which is better? 1. settexture(0,tex); settramsform(d3dts_world,ts); //do some render; //restore it settexture(0,0); settramsform(d3dts_world,identity); 2 alternative way ,I do not restore it, and I set state to 0 for necessary set. settransform(d3dts_world,identity); //render some thing without texture so I do not need to settexture(0,0); question 2 tex = createtexture(...); settexture(0,tex); //do something when I do tex.release();what happen to settexture(0,tex)? I mean I must settexture(0,0); if I do not set 0,what happen to future rendering?

Share this post


Link to post
Share on other sites
Advertisement
Firstly, this recent thread carries a lot of similar/useful information. Check it out if you haven't already.

Quote:
Original post by luasitdown
which is better?
1.
settexture(0,tex);
settramsform(d3dts_world,ts);
//do some render;
//restore it
settexture(0,0);
settramsform(d3dts_world,identity);
2
alternative way ,I do not restore it, and I set state to 0 for necessary set.
settransform(d3dts_world,identity);
//render some thing without texture so I do not need to settexture(0,0);

I'm not sure I totally understand what you're trying to achieve here. In general, it's very difficult for anyone to tell you "which is best" as only profiling will actually reveal the true performance characteristics.

Quote:
Original post by luasitdown
question 2
tex = createtexture(...);
settexture(0,tex);
//do something

when I do tex.release();what happen to settexture(0,tex)? I mean I must settexture(0,0); if I do not set 0,what happen to future rendering?

As long as the textures reference count is > 0 it will be "alive". If you call SetTexture() it should AddRef() the IDirect3DTexture9 object for the duration it holds a reference. Thus, if you SAFE_RELEASE() your copy and it's still set to the device it isn't going to be completely destroyed. The return value of Release() should indicate how many other references exist.

hth
Jack

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!