Short question about ID3D10ShaderResourceView

Started by
2 comments, last by Demirug 14 years, 9 months ago
Hi I've only a short question about ID3D10ShaderResourceView How can I test if a variable of the ID3D10ShaderResourceView type is set yet or not so for example i have the variable ID3D10ShaderResourceView pTexture now I want to test if pTexture has assigned any value yet or not if I want it to test with: if(pTexture == NULL) oder if(!pTexture) this has no effect for me. The if statement is always false and the block after the statement is never executed (I have pTexture stored in a struct and at the beginning of the application i allocate memory for a array of this struct. So there are some ID3D10ShaderResourceView variables in memory which shouldn't have any value right now)
Advertisement
I am not sure what you are doing. Can you show us some of your initialization code?
ok I want to code a simple TextureManager
therefore i have the following struct
	struct TextureManager	{		LPCWSTR textureName;						ID3D10ShaderResourceView*	 pTextureRV;		};


After program start I allocate an array of this struct. Lets say 15 elements for the beginning
When I want to add a new Texture to that array I have to check the array and find a free index (where pTextureRV is empty). And here is my problem: How can i check if the pTextureRV is empty or already filled? (pTexture == NULL or !pTexture doesn't work)
Now I understand your problem. C++ doesn’t fill newly allocated memory with useful values. It will contain garbage. Therefore you are responsible to set initial values (in your case NULL) to all elements in the array after memory allocation.

This topic is closed to new replies.

Advertisement