Jump to content
  • Advertisement
Sign in to follow this  

cal3d texture issue

This topic is 5101 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 looked through the developers forum and did not find an answer to this. I have a problem retrieving the userdata from the calcorematerial for texture mapping. I'm using the code from the miniviewer for cal3d ...it's layed out very differently but the same code. I've error tested and I am getting the texture filename and loading in the texture and getting and setting a valid id in the userdata. It's when I try to retrieve it in the render loop from the model instance (calRenderer) that I have problems. The renderer returns 0 for getMapCount for the selected mesh. I'm not sure exactly what I'm doing wrong. Thanks for any assistance. edit: After further testing it seems that the pCalRenderer->getMapUserData(0) line is not getting the user data of the currently selected mesh correctly in the render loop. I manually just grabbed the coreMaterial of the first mesh and got it's user data and there was the correct texture id of the first mesh. I'm still in a bit of a jam as there are more meshes than materials so I can't just use the mesh id to get the material...and I rather feel like I'm trying to re-write on my side what cal3d should already be doing. So I'm still not sure what I'm doing wrong here. [Edited by - danto on November 26, 2005 7:04:36 PM]

Share this post

Link to post
Share on other sites
Further Investigation:

Alright I've narrowed down the problem, but again I don't know why the problem is occuring.

This line is used to grab the stored texture id of the current submesh which is not working.

Looking under the hood it uses the following way of getting the coreMaterial:
pCoreMaterial = m_pModel->getCoreModel()->getCoreMaterial(m_pSelectedSubmesh->getCoreMaterialId());

The problem seems to be in the m_pSelectedSubmesh->getCoreMaterialId() as I've used the following line to get a corematerial and it works fine:

CalCoreMaterial* calCoreMat = curr->getModelInstance()->getCoreModel()->getCoreMaterial(0);

Now this only gets the first material, but it does work if I replace the user data line with:


It will then get the texture data and I can map it properly to my model. So it would seem that the calsubmesh is not storing the material id properly. I've been digging through the cal3d code trying to find where the material id is assigned to the submesh, but no luck yet.

Everything else works fine...I can render the model and it's animation just fine...just can't get these damn textures assigned. Well...back to digging.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!