Can anyone help here? I've been creating a 3D map editor for a project im working on and hit a problem with the Blitz3DSDK, I'm using Visual C# (in VS2005 with a coupe of extra Lib's) - Ive tracked the problem down to the bb.EntityName command.
I'm trying to get the name of the entity under the cursor, I can get the Entity ID / Number but when I try and convert this to the name of the entity the app throws a AccessViolationException error claiming I was trying to read or write to protected memory!!
I would also point out that this ONLY happens if I run the app on windows VISTA! (32 or 64bit) and runs perfectly on XP (32 or 64bit)
I have modified the sample source code to show the exception im getting (move the cursor over the block on the screen and it should crash) - just overwrite the program.cs code with:-
using System;
using bb = Blitz3DSDK;
static class RotateCube
{
[STAThread]
static void Main()
{
bb.BeginBlitz3D();
bb.Graphics3D(960, 540, 0, 2);
int value = 0;
string ename = "";
int cube = bb.CreateCube(0);
int light = bb.CreateLight(1, 0);
int camera = bb.CreateCamera(0);
bb.EntityPickMode(cube, 3);
bb.NameEntity(cube, "The-Cube");
bb.PositionEntity(camera, 0, 0, -4, 1);
while (bb.KeyHit(bb.KEY_ESCAPE) == 0)
{
bb.UpdateWorld(1);
bb.RenderWorld(0);
bb.CameraPick(camera, bb.MouseX(), bb.MouseY());
value = bb.PickedEntity();
if (value != 0)
{
//ename = ToString(value);
bb.Text(20, bb.GraphicsHeight() - 40, "Entity Name ="+value, 0, 0);
ename = bb.EntityName(value);
}
bb.TurnEntity(cube, .1f, .2f, .3f, 1);
bb.Text(20, bb.GraphicsHeight() - 20, "Blitz3DSDK C# Example (C)2007 Blitz Research 2007", 0, 0);
bb.Flip(1);
}
bb.EndBlitz3D();
}
}
Any Help would be very much appreciated!!
I'm trying to get the name of the entity under the cursor, I can get the Entity ID / Number but when I try and convert this to the name of the entity the app throws a AccessViolationException error claiming I was trying to read or write to protected memory!!
I would also point out that this ONLY happens if I run the app on windows VISTA! (32 or 64bit) and runs perfectly on XP (32 or 64bit)
I have modified the sample source code to show the exception im getting (move the cursor over the block on the screen and it should crash) - just overwrite the program.cs code with:-
using System;
using bb = Blitz3DSDK;
static class RotateCube
{
[STAThread]
static void Main()
{
bb.BeginBlitz3D();
bb.Graphics3D(960, 540, 0, 2);
int value = 0;
string ename = "";
int cube = bb.CreateCube(0);
int light = bb.CreateLight(1, 0);
int camera = bb.CreateCamera(0);
bb.EntityPickMode(cube, 3);
bb.NameEntity(cube, "The-Cube");
bb.PositionEntity(camera, 0, 0, -4, 1);
while (bb.KeyHit(bb.KEY_ESCAPE) == 0)
{
bb.UpdateWorld(1);
bb.RenderWorld(0);
bb.CameraPick(camera, bb.MouseX(), bb.MouseY());
value = bb.PickedEntity();
if (value != 0)
{
//ename = ToString(value);
bb.Text(20, bb.GraphicsHeight() - 40, "Entity Name ="+value, 0, 0);
ename = bb.EntityName(value);
}
bb.TurnEntity(cube, .1f, .2f, .3f, 1);
bb.Text(20, bb.GraphicsHeight() - 20, "Blitz3DSDK C# Example (C)2007 Blitz Research 2007", 0, 0);
bb.Flip(1);
}
bb.EndBlitz3D();
}
}
Any Help would be very much appreciated!!