New Release D3D9Client Development

Ripley

Tutorial translator
Donator
Joined
Sep 12, 2010
Messages
3,135
Reaction score
409
Points
123
Location
Rome
Website
www.tuttovola.org
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:
 

jroly

Donator
Donator
Joined
Jan 26, 2014
Messages
404
Reaction score
1
Points
18
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.
 

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
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:

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
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

  • Topo-OGCI.zip
    283.2 KB · Views: 8

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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:

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
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:

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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

  • D3D9ClientBeta14-forRev44.zip
    1.1 MB · Views: 150

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Am I the only one with dark sky since D3D9ClientBeta14-forRev 44 ?
 
Last edited:

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,446
Reaction score
700
Points
203
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?
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
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:

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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 ?
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
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:
Joined
Mar 23, 2008
Messages
165
Reaction score
0
Points
16
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

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
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!
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
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 ?
 

Cras

Spring of Life!
Donator
Joined
Apr 13, 2011
Messages
2,215
Reaction score
0
Points
36
Location
Los Angeles
Website
www.youtube.com
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.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
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:
Top