- Joined
- Jun 6, 2012
- Messages
- 317
- Reaction score
- 126
- Points
- 43
- Location
- Sydney, Australia, Earth, Sol
- Website
- www.orbithangar.com
Hi all,
I am working on a virtual cockpit which has a screen (simillar to the DeltaGlider's propellant status screen), and I am having some difficulties getting it to work properly with the D3D9 graphics client. It would appear on every redraw event, any objects are simply superimpossed over previously drawn objects (text, polygons, etc). Text for example will keep writing on top of itself until just rectangles are visible where characters once were, and I do not have this issue when running in Orbiter.exe (no D3D9 client).
This is the code I have, it's just a simple panel which for now just displays the outside pressure.
in clbkLoadVC:
and in clbkVCRedrawEvent:
and finally in the function 'RedrawPanel_CabinPress'. This just displays the outside pressure:
If anyone could offer any advice I would really appreciate it. Thank you all!
MrMartian
I am working on a virtual cockpit which has a screen (simillar to the DeltaGlider's propellant status screen), and I am having some difficulties getting it to work properly with the D3D9 graphics client. It would appear on every redraw event, any objects are simply superimpossed over previously drawn objects (text, polygons, etc). Text for example will keep writing on top of itself until just rectangles are visible where characters once were, and I do not have this issue when running in Orbiter.exe (no D3D9 client).
This is the code I have, it's just a simple panel which for now just displays the outside pressure.
in clbkLoadVC:
C++:
bool MyVessel::clbkLoadVC (int id)
{
switch (id) {
case 0: // pilot
SetCameraOffset (_V(0,1.2,12.5));
SetCameraShiftRange (_V(0,0,0.1), _V(-0.2,0,0), _V(0.2,0,0));
//pressure display panel
SURFHANDLE tex1 = oapiGetTextureHandle (mh_cockpit,4); //defines tex1 for the texture handle that will display the callout
oapiVCRegisterArea (AID_PRESS_DISPLAY,_R( 16, 104, 284, 213), PANEL_REDRAW_ALWAYS, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex1); // register the surface handle and spacing for the callout display/when visible/etc.
}
return true;
}
and in clbkVCRedrawEvent:
C++:
bool MyVessel::clbkVCRedrawEvent (int id, int event, SURFHANDLE surf)
{
switch (id) {
case AID_PRESS_DISPLAY:
RedrawPanel_CabinPress (surf, AID_PRESS_DISPLAY);
return true;
}
return false;
}
and finally in the function 'RedrawPanel_CabinPress'. This just displays the outside pressure:
C++:
void ShuttlePB::RedrawPanel_CabinPress (SURFHANDLE surf, int disp)
{
// register the text parameters
char cbuf[20];
HDC hDC = oapiGetDC (surf);
SelectObject (hDC, g_Param.hFont[2]);
SelectObject (hDC, g_Param.hBrush[1]);
SetTextColor (hDC, RGB(0,255,0));
SetBkMode (hDC, TRANSPARENT);
SetTextAlign (hDC, TA_RIGHT);
switch (disp) {
case AID_PRESS_DISPLAY:
{
// display outside pressure
sprintf (cbuf, "%0.3f", GetAtmPressure());
TextOut (hDC, 222, 42, cbuf, strlen(cbuf));
oapiBltPanelAreaBackground (AID_PRESS_DISPLAY, surf);
}
break;
}
oapiReleaseDC (surf, hDC);
}
If anyone could offer any advice I would really appreciate it. Thank you all!
MrMartian