New Release D3D9Client Development

Ok, thanks.
So it's mostly an environment for you, D3D9 developers (and others that might help you).

It's definitely not in my plans to set the compiler up and build it myself, so I'll keep on grabbing it here (or on other sites - why not Orbit Hangar then?), whenever you post a new binary version.

:cheers:
 
Not sure if this has been mentioned but when on the moon the Earth does not have texture, it is just a blue ball until you travel closer to it. Does not happen in dx7 version.
 
Hi Jarmo,

Please take a look on this bug report of the inline client:
http://www.orbiter-forum.com/project.php?issueid=1219

it also doesn't work perfectly in the DX9 client. Everything is great in windowed mode, but in the fullscreen mode, it doesn't work in the glass cockpit. The exact behavior is that the MFD gets painted once, but never updated again.

[EDIT]
I've just noticed, that it works fine in window + glass cockpit mode only until resolution of 1300x812.

My graphics cards are Intel 4000 and GeForce GT 630M . Both share the same behavior.
 
Last edited:
Jarmo, Thanks for your reply in the Bugs section.
Following your tip, I tried to change my code to use OGCI (attached). Although I have initialized the OGCI in the MFD's constructor, and even tested if the blitting function is called via debug session, I still see no effects. Would you be so kind and look at the code, or maybe even compile it and see for yourself? You'd only need to select your Orbiter BETA installation dir in the project's property sheet, and select Release-Beta or Debug-Beta as the target.

The relevant functions are:
PHP:
TopoMap::TopoMap(int width, int height)
{
    W = width;
    H = height;
    m_surface = oapiCreateSurface(W, H);
    oapiColourFill (m_surface, 0);
}
TopoMap::~TopoMap()
{
    oapiDestroySurface(m_surface);
}

void TopoMap::Draw(oapi::Sketchpad *skp)
{

    ogciSketchBlt(skp, m_surface, 0, 0);
    //oapiBlt(skp->GetSurface(), m_surface, 0, 0, 0, 0, W, H);
}
PHP:
// Constructor
TopoMapMFD::TopoMapMFD (DWORD w, DWORD h, VESSEL *vessel, PluginTopoMapMFD * plugin)
    : MFD2 (w, h, vessel)
    , m_tm(w, h)
    , m_plugin(plugin)
{
    ogciInitialize();
    m_plugin->SetTopoMap(&m_tm);
}

bool TopoMapMFD::Update (oapi::Sketchpad * skp)
{
    m_tm.SetRGB(m_rgb);
    m_tm.Draw(skp);
    Title(skp, "Topographic Map MFD");

    DrawEllipse(skp, 2, Pens::Green);
    DrawEllipse(skp, 3, Pens::Red);
    MFDTextCalculator mcalc(W, H);
    const int x = 1;
    int y = 2;
    MFDTextOut(skp, mcalc.X(x), mcalc.Y(y++), GREEN, "Refresh lines = %d", m_tm.GetRefreshLines());
    MFDTextOut(skp, mcalc.X(x), mcalc.Y(y++), RED,   "Refresh lines = %d", m_tm.GetRefreshLines());
    return true;
}

Thanks in advance.
 

Attachments

The drawing surface must be configured as OAPISURFACE_TEXTURE|OAPISURFACE_RENDERTARGET. Make sure that ogciInitialize() is called before calling any ogci* function.

oapiCreateSurfaceEx is not working for some reason.

Code:
TopoMap::TopoMap(int width, int height)
{
    W = width;
    H = height;
    m_rgb = false;
    m_lineRefreshed = 0;
    ogciInitialize();
    m_surface = ogciCreateSurfaceEx(W, H, OAPISURFACE_TEXTURE|OAPISURFACE_RENDERTARGET);
    oapiColourFill (m_surface, 0);
    highest = 5000;
    lowest = -5000;
}


There appears to be out-of-bounds rendering issue causing a lot of errors to appear.
Code:
if (xx>=(W-1)) xx=W-1;
if (yy>=(H-1)) yy=H-1;
oapiColourFill (m_surface, col, xx, yy, 1, 1);

With these fixes it's working here.

Also, note that ogci* is experimental and changes will likely occur.
Also, note that ogciSketchBlt only works if the sketchpad is running in DirectX mode. In some conditions it can use GDI wrapper.
 
Last edited:
Perfect! Thank you very much. Also for the initiative of exposing the ogci* functions in the first place.

An interesting find is that after increasing the resolution above 1300x812, the MFD dimensions become odd numbers, and this was causing the inability of redrawing of the surface. This snippet fixes it:

PHP:
TopoMap::TopoMap(int width, int height)
{
    if (!ogciEnabled())
        ogciInitialize();
    W = width;
    H = height;
    if (W%2 != 0) // W and H must be even, or the surface doesn't get redrawn.
        W--;
    if (H%2 != 0)
       H--;
    // ...
}

BTW, somehow the MFD works even with GDI only.
Jarmonik said:
Also, note that ogci* is experimental and changes will likely occur.
No problem. The whole MFD is experimental anyway. I made a local, renamed copy of the OGCI.h and .cpp.
 
Last edited:
An interesting find is that after increasing the resolution above 1300x812, the MFD dimensions become odd numbers, and this was causing the inability of redrawing of the surface. This snippet fixes it:

I am not aware of any even/odd limitations in surface sizes but I may have missed something. It's good to keep that in mind, just in case, if we encounter any problems with drawing.

I suppose it might be good to have something like:

void * ogciLockSurface(SURFHANDLE hSrf, DWORD flags)

that would provide a direct read/write access to a surface data.
 
D3D9ClientBeta14-forRev 44

- Sketchpad interface is now fully implemented in DirectX. Pen width parameter should be working with all drawing commands.
- Reflection model is now online.
- Custom camera interface is now online.
 

Attachments

Am I the only one with dark sky since D3D9ClientBeta14-forRev 44 ?
 
Last edited:
Am I the only one with dark sky since D3D9ClientBeta14-forRev 44 ?
All good here. Maybe you didn't extract all the files in the Modules\D3D9Client subfolder and let them overwrite the old ones?
 
Strangely, have gone through all files in all folders from Config through Textures, replacing them with D3D9ClientBeta13c-forRev43 versions.
Nothing worked until reverted to D3D9Client.dll from Rev43, then I have normal sky again.:shrug:

If I drop D3D9Client.dll from Rev43 into D3D9ClientBeta14-forRev44 installation - normal sky again.
 
Last edited:
Strangely, have gone through all files in all folders from Config through Textures, replacing them with D3D9ClientBeta13c-forRev43 versions.
Nothing worked until reverted to D3D9Client.dll from Rev43, then I have normal sky again.:shrug:

During a development process there was a time when reflections looked pretty much like your screen shot. Black sky and odd horizon color.

Does the Earth look OK if you view it from orbit ?

Could you check that Video->Advanced->"Reflection and Custom camera settings" are all disabled ? Do disabling/enabling them have any effect ? (In Beta14)

What kind of graphics chip do you have ?

I'll install the latest orbiter beta on my laptop tomorrow and I'll make some test runs.

BTW, is anyone else seeing that ?
 
Custom Camera was enabled but disabling had no effect.
Disabling/Enabling Reflection Mode/Planet Only/ Full Scene has no effect.
Screen shot of earth attached.
Graphics chip: Intel(R) HD Graphics 4000
 
Last edited:
Daytime planet visibility

BTW, is anyone else seeing that ?

I can't reproduce it.

On the subject of atmosphere, no biggie, but I do notice that I can see planets in the daytime sky, something I wouldn't normally expect (except the obvious eg Venus etc), and it does not happen in the inline client. The screen-grab is at extreme FOV but that has no effect.
 

Attachments

  • CurrentState - Copy.jpg
    CurrentState - Copy.jpg
    52.5 KB · Views: 47
Graphics chip: Intel(R) HD Graphics 4000

I just tested it with my dual core i3 laptop with HD Graphics 4000 under Win 10 and everything was working as expected. No problems with atmosphere.
 
Guess I'll have to hang on with my "D3D9ClientBeta13c-forRev43 insert" until the next release and see what happens.....
Thanks for your efforts.
jarmonik, you're creating a beautiful environment - keep up the good work!
 
Guess I'll have to hang on with my "D3D9ClientBeta13c-forRev43 insert" until the next release and see what happens.....

I think I found the problem. It would seem that you are actually running Beta14 client with r.43 or older Orbiter. Could you make sure that you have r.44 Orbiter and the Beta14 client installed and see if it runs correctly and if we can close this issue ?
 
On the subject of atmosphere, no biggie, but I do notice that I can see planets in the daytime sky, something I wouldn't normally expect (except the obvious eg Venus etc), and it does not happen in the inline client. The screen-grab is at extreme FOV but that has no effect.

This has been the case with D3D9 client going back for as far as I can even remember right now, the releases for 2010p1 exhibit this behavior as well.
 
I think I found the problem
Is this what I should be seeing?
(Orbiter with inline client is 5 Dec 2015 [v.151205])

Sorry for late response - life commitments :cry:
 
Last edited:
Back
Top