Jump to content
  • Advertisement
Sign in to follow this  

Problem with FindNextValidTechnique

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

I'm trying to construct mappings for string to technique IDs for my renderer, but it looks like FindNextValidTechnique is not operating correctly. It's probably something somewhere else in my program, but I want to know if I'm doing this bit right before I go hunting.
		// Construct technique mappings
		int EffectID = (int)m_Effects.size() - 1;
		D3DXHANDLE CurrentHandle = NULL;
		D3DXHANDLE NextHandle = NULL;
			 pEffect->FindNextValidTechnique(CurrentHandle, &NextHandle);
			 if(NextHandle != NULL)
				CTechniqueInfo TechniqueInfo;
				TechniqueInfo.m_hTechniqueHandle = NextHandle;
				TechniqueInfo.m_nEffectIndex = EffectID;
				m_TechniqueNameMap[string(NextHandle)] = m_nTechniqueCounter; // Error here
				m_TechniqueInfo[m_nTechniqueCounter] = TechniqueInfo;
		} while (NextHandle != NULL);

I get an error when I try to construct the string from the handle, because the handle is an invalid pointer. D3DXHANDLEs are just LPCSTRs, so this should work if the pointer's valid. The thing is, FindNextValidTechnique fills NextHandle with an invalid pointer. pEffect points to a valid effect.

Share this post

Link to post
Share on other sites
Just because these handles are implemented as LPCSTR's does not mean the right interpretation is that they contain the name of the technique. You must obtain the D3DXTECHNIQUE_DESC using GetDesc() and check the name member of that structure instead.


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!