Archived

This topic is now archived and is closed to further replies.

cronos

To disable texture units in DirectX

Recommended Posts

I wonder how to disable texturing. I mean, the directX homogeneous function of the opengl " glDisable(GL_TEXTURE_2D) "

Share this post


Link to post
Share on other sites
HRESULT IDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);

Disable color ops and alpha ops. I assumed you could turn off all texturing through SetRenderState() but I couldn''t find anything that did so.

------------
- outRider -

Share this post


Link to post
Share on other sites
You could call "SetTexture(0, NULL);", however I''m not exactly sure what you mean by "disable texturing". Do you mean rendering an object without any textures, or rendering an entire scene without texture?

Share this post


Link to post
Share on other sites
quote:

Disable color ops and alpha ops. I assumed you could turn off all texturing through SetRenderState() but I couldn't find anything that did so.



Yep disabling color and alpha ops looks like if the texture be disable. But as far as I test, some texture operations are still computed, just they don't output the result. (At least the benchmarking don't behave as if you never call the SetTexture function)

quote:

You could call "SetTexture(0, NULL);"



That don't work I try it and directx just seems to discard the call.

quote:

however I'm not exactly sure what you mean by "disable texturing". Do you mean rendering an object without any textures, or rendering an entire scene without texture?



Suppose you load a single texture and want to apply it to a polygon. But for example I want to toggle texturing every time I clik, but after I call the SetTexture for the first time; the texture is loaded to the sampler I choose, and I haven't found a way to unload it so the polygon don't show any texture.

[edited by - cronos on March 30, 2004 10:47:23 AM]

[edited by - cronos on March 30, 2004 10:48:58 AM]

Share this post


Link to post
Share on other sites
All you have to do is call "SetTexture(0, NULL);", and then render your object. Since you are rendering every frame, just set a variable whenever you click and use a conditional deciding whether to apply the texture or not. That should work.

If you want to render a wireframe, that is a different matter.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

Disable color ops and alpha ops. I assumed you could turn off all texturing through SetRenderState() but I couldn''t find anything that did so.


quote:

You could call "SetTexture(0, NULL);"



Yes, my fault: both are right.

Seems that I have erased some lines and that''s why nothing behave as they were expected to.
Thanks for the answers!

Share this post


Link to post
Share on other sites
No, that is equivelant to say glBindTexture (null) or something.

To disable all texture units, set the color operation to disable for level 0. That will disable all higher levels as well.

Share this post


Link to post
Share on other sites