Problem Cannot create a mesh group for a panel

Bibi Uncle

50% Orbinaut, 50% Developer
Addon Developer
Joined
Aug 12, 2010
Messages
192
Reaction score
0
Points
0
Location
Québec, QC
Hi everyone !

I'm currently working on Project Mercury and I have a problem with the panel. I'm trying to create a new VESSEL3 panel. I already did it on a test project and it worked very well. However, I can't do it for Project Mercury.

The Mercury capsule inherits of VESSEL3 and in clbkLoadPanel2D (the new callback), I have this :

Code:
static DWORD panelW = 1280;
static DWORD panelH = 611;
float fpanelW = (float)panelW;
float fpanelH = (float)panelH;
static DWORD texW = 2048;
static DWORD texH = 1024;
float ftexW = (float)texW;
float ftexH = (float)texH;
static NTVERTEX VTX[4] =
{
{ 0.0f, 0.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,24.0f/ftexH},
{ 0.0f,fpanelH,0.0f, 0.0f,0.0f,0.0f, 0.0f,635.0f/ftexH},
{fpanelW,fpanelH,0.0f, 0.0f,0.0f,0.0f, fpanelW/ftexW,635.0f/ftexH},
{fpanelW, 0.0f,0.0f, 0.0f,0.0f,0.0f, fpanelW/ftexW,24.0f/ftexH}
};
static WORD IDX[6] =
{
0,2,1,
2,0,3
};
MESHGROUP grp = {VTX, IDX, 4, 6, 0, 0, 0, 0, 0};
if(hPanelMesh) oapiDeleteMesh (hPanelMesh);
hPanelMesh = oapiCreateMesh(0,0);
oapiAddMeshGroup (hPanelMesh, &grp);
SetPanelBackground(hPanel,0, 0,hPanelMesh,panelW,panelH);
return true;

I removed every other callbacks to check if Mercury calls some funtions that may cause a problem, but I still get a 0xC0000005 runtime error from VC++. It is an access violation error. The error does not occur in my code, it is Orbiter. The last call is d3dim700.dll. Also, if I remove
oapiAddMeshGroup (hPanelMesh, &grp); and/or
SetPanelBackground(hPanel,0, 0,hPanelMesh,panelW,panelH);, I have no error. Finally, if I return false or I do not load the panel, everything works fine.

Any idea ? :sos:
 
I'm assuming it's crashing after the callback has returned execution to Orbiter, or are there any other callbacks of your module being called before the crash?

What's the difference between that callback in the working test project and crashing Project Mercury? I'm guessing that only panel dimensions and UV map coordinates are different?
 
Thank you for your reply!

In fact, when I was testing it with the other callbacks, Orbiter was calling clbkPreStep and it crashes just after it. Now, because there is no more clbkPreStep, it crashes just after the panel is loaded.

There is no difference between the test project code and Project Mercury. I copied/pasted the panel code into Project Mercury. I just wanted a basic panel to modify it later.
 
I'm no C expert, as most folks know...but this:

Code:
static WORD IDX[6] =
{
0,2,1,
2,0,3
};

Dosen't this make an array with 7 elements, but its only getting 6 values?

Tin hat on.

N.
 
Code:
static WORD IDX[6] =
{
0,2,1,
2,0,3
};

Dosen't this make an array with 7 elements, but its only getting 6 values?

Tin hat on.

N.
No. This makes 6 element array, but an element of an array referenced this way, i.e. `IDX [6]` would be 7th element of that array.
 
Thanks Orb, I've been confused with this before!

N.
 
Did you try with a nonempty texture surface for SetPanelBackground, i.e.:
`SetPanelBackground (hPanel, &someTextureSurface, 1, hPanelMesh, panelW, panelH);`?
 
THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU ! THANK YOU !
:woohoo:

It works with a texture now !!! There is not enough thanks to thank you orb ! I actually jumped from my chair when I saw the Project Mercury working with the new panel interface ! I can finally work on Project Mercury ! Maybe a little notice in the documentation would be nice...

I'll hail the probe a hundred times before going to bed this night :lol:
:hailprobe:
 
Back
Top