XNA Game Development Forums
2012/05/21 21:08:36 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: 3d Engine-- Tutorial 2 problem.  (Read 2204 times)
ZebraHDH
Newbie
*
Offline Offline

Posts: 1


View Profile
« on: 2006/11/10 02:30:24 »

Hey, I didn't even realize that you had a forum. I would have asked my question here at the very beginning, so thats for the redirection...

Ok my problem is pretty specific now that have tried to solve it through moving things, and renaming, and reorganizing... but no luck with getting it solved.

http://www.thehazymind.com/archives/2005/06/tutorial_2_crea.htm

I read tutorial 2 and downloaded the source(c# files), then updated my c#, directX, and .NET SDK's... I followed along typing my own code with tutorial 2....When I run the program, it begins to run then goes straight to a "!". I double checked by running your sources, and making the changes to directx and presentParams and such... but I get the exact same problem:

Code:
myDevice.Clear(ClearFlags.Target, Color.CornflowerBlue, 1.0f, 0);

Quote
Object reference not set to an instance of an object

I assume myDevice is NULL and it can't be. The Device myDevice is set up the same way as in the tutorial.

I literally am using the exact source code made available. I have no idea what to do, because I don't even see the problem. ::frustrating:: I have come to believe that the error may have to do with something in Visual C# itself. I am not familiar with it enough to know for sure.

Any info that you need from me, to come up with a solution to this I will post ASAP. I am having horrible luck with C# and I would like to start getting somewhere eventually...

Any troubleshooting advice is helpful, considering this could be a simple "why didn't I think of that" type of thing.

Thanks,

Hans
Logged
daku
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #1 on: 2006/11/27 22:43:16 »

I have the same problem.  After a long while comparing code the only thing I could find different about mine vs the tutorial is this:

#region Using directives 

That was missing from my *System.cs at the very top.  I ended up copying and pasting a lot of stuff just trying to solve it,  I dont know if this matters (total noob).  I cant go back to what I originally had to try this one line, but now that it is in there it seems to work.  :\
Logged
daku
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #2 on: 2006/11/27 22:53:51 »

Actually after reading what the #region does that doesnt matter at all.  I was able to run by removing that.  All I can say is that SOMETHING must be wrong because after copying and pasting code from the tutorial in I managed to get it working.  If you can compare yours to the tut someway you might be able to solve it...
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #3 on: 2006/11/28 00:46:25 »

Key reason it won't work is the Clear method is being called BEFORE you create the object, that is, before you call
Code:
myDevice = new Device(...);
Put a breakpoint at that bit of code, in your InitializeGraphics function and see if you get the exception before that. If you do then the flow is incorrect and you need to look through your code. The InitializeGraphics function should run BEFORE Render() so either call it from the Form constructor or make it public and call it in your mainline method before Application.Run().

I hope this helps, usually its a small problem which the compiler doesn't pick up, a logic error, which when you are learning from a tutorial can be easy to make, since this is all new. Sometimes even just copy pasting the code will fix it, and you won't know why.
Logged

tuxdalinux
Newbie
*
Offline Offline

Posts: 5


View Profile
« Reply #4 on: 2006/12/03 14:20:43 »

also another thing you need to make the engine a class library under the properties, that should fix that problem (had that when i first started this)
Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
rewriting the engine Hazy Mind 3D Engine endre 5 3323 Last post 2006/08/08 01:59:44
by Chr0n1x
If people want, can visit ;) nearly great and developing engine... Show Off Board satsatsat 0 2543 Last post 2006/10/27 04:18:12
by satsatsat
MOVED: XNA Tutorials :: Game Engine and Game Development :: Tutorial 1 Hazy Mind 3D Engine mikeschuld 0 2366 Last post 2006/10/30 21:35:32
by mikeschuld
Got a problem with an .x file Hazy Mind XNA Engine bobbie_dache 8 2784 Last post 2007/01/16 12:26:30
by bobbie_dache
Tutorial 9 :: Running the Engine on the Xbox 360 Tutorial Discussion mikeschuld 6 3497 Last post 2007/03/09 23:54:35
by Tiago
Some thoughts on the engine... Hazy Mind XNA Engine letsrock 2 1701 Last post 2007/01/27 12:36:45
by mikeschuld
New Engine Architecture method Hazy Mind XNA Engine mikeschuld 3 1805 Last post 2007/03/11 21:09:17
by Chr0n1x
Animations! But one problem... Hazy Mind XNA Engine EclipsE 2 1415 Last post 2007/04/12 02:42:27
by EclipsE
tutorial 4 problem Hazy Mind 3D Engine precious roy 3 2499 Last post 2007/08/03 12:24:26
by mikeschuld
Interface problem. Help!! General Discussion XNASorcerer 5 2112 Last post 2007/05/09 09:46:36
by CarlosFreitas
ObjectManagers problem Hazy Mind XNA Engine Jonotron 1 1341 Last post 2007/08/03 12:29:19
by mikeschuld
Camera problem Hazy Mind XNA Engine Montynis 2 1686 Last post 2007/08/02 09:54:14
by Montynis
Problem with the pick Hazy Mind 3D Engine Zandman26 0 1422 Last post 2007/08/06 15:04:06
by Zandman26
Engine's performances General Discussion new.proger 2 2234 Last post 2008/12/24 00:58:36
by Nemo Krad
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.31 seconds with 18 queries.