Jump to content

Problems with c# headers (Loading Scene and access violation)


Blitzbat
 Share

Recommended Posts

Hi !

 

I have problems with the c# headers ;)

 

If I'm trying to load a scene i can't see anything...

 

I have tried to get an entity by key but than a AccessViolationException was thrown (in Core.EntityPosition(this.Pointer, position, 0))

 

Here is my code:


Scene s = Scene.Load("abstract::test.sbx");
Vector3 campos = s.GetChild("camera_start").Position; //here the AccessViolationException is thrown.
this.maincam.Position = campos;

 

 

Thanks for your help!

 

Blitzbat

Link to comment
Share on other sites

Make sure you check that the camera returned by s.GetChild is not null.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Hey!

 

Ok. Something is being bad here... This simple code does not work :). I only see a black screen.

 

Graphics.Initialize(this.width, this.height);
Framework.Initialize(true);

if (Framework.Layers.Main.World.Pointer == World.NullPointer) {
   return;
}

Texture.TFilterMode = 1;
Texture.AFilterMode = 4;

Graphics.Initialize(this.width, this.height);
Framework.Initialize(true);

if (Framework.Layers.Main.World.Pointer == World.NullPointer) {
return;
}
Texture.TFilterMode = 1;
Texture.AFilterMode = 4;

Entity box = Mesh.CreateCube();
box.Move(new Vector3(0.0f, 0.0f, 10.0f));
while (!Window.HasRequestedClose()) {

World.Update(1);

World.Render();

Graphics.Flip();



}

Leadwerks.Engine.Terminate();

 

Can someone help me?

 

Thanks!

Link to comment
Share on other sites

There is no camera. Try creating one with:

Camera camera = new Camera();

By the way, some parts of your code are repeated.

 

 

Hi!

 

Yes sorry it was a copy and paste bug ;)

 

Now i have creaed a camera. But the same here... Black screen

Link to comment
Share on other sites

And here it comes ;)

 

       public void Run() {

           this.config.LoadFile("config.ini");

           this.height = this.config.GetIntValue("video", "height");
           this.width = this.config.GetIntValue("video", "width");
           this.depth = this.config.GetIntValue("video", "depth");

           Graphics.Initialize(this.width, this.height);

           new World();

           Camera cam = new Camera();
           Entity box = Mesh.CreateCube();
           box.Move(new Vector3(0.0f, 0.0f, 5.0f));
           while (!Window.HasRequestedClose()) {

               World.Update(1);

               World.Render();


               Graphics.Flip();



           }

           Leadwerks.Engine.Terminate();
       }

Link to comment
Share on other sites

The LE C++ library is just more mature and has been around longer. The C# library has gone through some revisions and has been around a shorter amount of time so it just needs time to become stable. Although the lesson for anyone maintaining a different language library is to not always mess around with how it works because people get annoyed when things change all the time.

Link to comment
Share on other sites

I don't think someone's inability to code means the wrapper/framework is flawed. The code posted had blatant errors that would cause this problem, and with a straight copy of the code I do infact get the described issue :).

 

Lazlo has cooked up quite the "book" on this to make sure that C# has the strongest support in the area of new users.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Yeah, I wasn't trying to imply that. I was just saying that if a library changes often enough people get confused (with all the old posts out there) and it makes people not "trust" it enough to use it in their projects.

 

The old posts and such is a real problem I think. For someone new in LE C# it can be confusing as to what you are supposed to us (currently).

Link to comment
Share on other sites

Is there a tutorial/guide somewhere to set up LE with C#?

Visual Studio 2010 is looking fantastic.

I don't know how will be different the code from the new incoming wrapper, but I wrote a "getting started" which used the 1.32 version of the wrapper (I don't think the new wrapper will be enough different to invalidate that tutorial or the other one I wrote for Lights, if needed I will update them when the new will be released).

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

I don't know how will be different the code from the new incoming wrapper, but I wrote a "getting started" which used the 1.32 version of the wrapper (I don't think the new wrapper will be enough different to invalidate that tutorial or the other one I wrote for Lights, if needed I will update them when the new will be released).

Thanks ZioRed, that worked!

Have you (or anyone else) got it working inside a container, so I can use the Windows Forms Controls at the same time?

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...