Skip to main content
gamedev.net
🔒 Locked

Problem with FindNextValidTechnique

Started by wasd Oct 10, 2005 at 1:30 PM 1 replies 450+ views
Original Post
wasd
wasd
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;
		do
		{
			 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;
				++m_nTechniqueCounter;
			 }
		} 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.
Illco
Illco
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.

Illco
wasd
wasd
Thanks, that's got it sorted.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.