Sign in to follow this  

state change in dx

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

This topic is 4360 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.

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