Go Back   AC3D Forums > Resources > AC3D Tutorials and How-To's
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 2nd April 2012, 04:52 PM   #1
Draxxar
Junior Member
Junior member
 
Join Date: Mar 2012
Posts: 1
Default Loading .X file in C# XNA color0 error resolved

Hi,
I found this problem when following the following tutorial (from another site) on using XNA and C# to load .X files (tutorial here: http://www.riemers.net/eng/Tutorials...ries2/tut5.php). The problem is, if you open up AC3D and go to "object library" and "samples"... then open up, say, the "enterprise" model and then export that as a .X file to test in that tutorial you'll get a crash error that says something to the effect of a "color0" error. This happens even if you texture or color the mesh objects.
After looking into it the reason for the crash bug in the above mentioned tutorial is because that tutorial is using custom effects. So if you instead replace the code with a BasicEffect then you can load up pretty much any .X file exported from AC3D without any problems.

Example:
Code:
foreach (ModelMesh mesh in myModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = modelTransforms[mesh.ParentBone.Index] * worldMatrix;
                    effect.View = viewMatrix;//  fpsCam.ViewMatrix;
                    effect.Projection = projectionMatrix;//  fpsCam.ProjectionMatrix;
                    
                }                
                mesh.Draw();
            }
Attached Files
File Type: zip C_sharp_sourcecode.zip (5.3 KB, 156 views)
Draxxar is offline   Reply With Quote
Old 4th April 2012, 12:53 PM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 3,795
Default Re: Loading .X file in C# XNA color0 error resolved

Are there some changes that could be made to the .X exporter output that would fix this problem?
Andy is offline   Reply With Quote
Reply

Tags
bug, c sharp, color0, crash, xna

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 08:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
(C) Inivis Limited 2014