New Release D3D9Client Development

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,226
Reaction score
592
Points
128
That's actually "rings the bell" (not sure if it's said right) Could it be a web browser plugin like add-blocker or something like that. Pop-up windows maybe ?

Nothing as changed in client side and I am out of ideas, so there's nothing I can do.

I am running Orbiter, VS and adobe reader open all the time so they are Ok.

Yeah, that could be it. I will have to investigate further, but that would certainly explain why I have extended periods of time without any problem when I don't do anything with the browser at the same time, if the theory is correct.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
First of all, Has anyone noticed a change in a frame rate in latest build compared to 3-4 builds back ? There is significant change in frame rate in my end, not sure where it's coming from. A change in driver settings maybe.

Yesterday I noticed that my frame rate is capped at 60fps in D3D9... other than that, nothing new.
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,434
Reaction score
689
Points
203
Yesterday I noticed that my frame rate is capped at 60fps in D3D9... other than that, nothing new.
Disable v-sync?
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
Looks like we have a problem.

Started adding the D3D9 stuff...

Code:
2>gcAPI_dbg.lib(gcAPI.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1600' in ASE_IUS.obj
2> Creating library Debug\Atlantis\SpaceShuttleUltra.lib and object Debug\Atlantis\SpaceShuttleUltra.exp
2>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
2>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
2>gcAPI_dbg.lib(gcAPI.obj) : error LNK2019: unresolved external symbol __ftoui3 referenced in function "unsigned long __cdecl gcColor(union oapi::FVECTOR4 const *)" (?gcColor@@YAKPBTFVECTOR4@oapi@@@Z)
2>..\..\Modules\SpaceShuttleUltra.dll : fatal error LNK1120: 1 unresolved externals
I guess it's time to upgrade vs2010. :facepalm:

I got the same errors when linking gcAPI.lib into a VS2008 project. We must find a solution to fix these linking issues and make it more user friendly. Any ideas how the OrbiterSoundSDK is build ?

I suppose I could try to build the gcAPI.lib with VS2008 and different compiler options to see if it helps.

Right now the gcAPI.lib is just one file gcAPI.cpp compiled into a static link library. It should be possible simply to compile gcAPI.cpp directly in a project instead using the pre-compiled library but it may grow bigger in the future.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
Here's a new library build with VS2008. At-least here it's compiling fine with both VS2008 and VS2015.


My Configuration:
Runtime Library: Multi-threaded Debug /MTd
Ignore Specific Default Libraries: MSVCRT.lib;LIBCMT.lib

Remove gcAPI_dbg.lib, it shouldn't be needed. So, only one lib should exists gcAPI.lib

Does this help ?
 

Attachments

  • gcAPI.zip
    4.6 KB · Views: 12

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
No problems now! Thanks! :thumbup:

---------- Post added 06-22-16 at 12:23 AM ---------- Previous post was 06-21-16 at 07:13 PM ----------

I'm sorry to bother (again), but I'm having problems getting this to work:
Code:
#include "gcAPI.h"
#include "Sketchpad2.h"

//  ---- Init Code ----

SKETCHMESH hMesh = NULL;

if (gcInitialize()) {
    hMesh = gcLoadSketchMesh("Phobos");
}


// ---- Render Code -----

if (gcSketchpadVersion(pSkp)==2 && hMesh) {

    // It is safe to cast to Sketchpad2 only if version returns 2
    oapi::Sketchpad2 *pSkp2 = (oapi::Sketchpad2 *)pSkp;

    // Build World Matrix, zFar clip plane is at max(W,H) and zNear plane is at 0.0f    
    FMATRIX4 mat;
    gcWorldMatrix(&mat, _V(float(W/2), float(H/2), float(W)), _V(1,0,0), _V(0,0,1), 200.0f); 

    // Apply World transform        
    pSkp2->SetWorldTransform(&mat);

    // Render Mesh group 0
    // Resulting color.rgba = Texture.rgba * Material.rgba * Pen.rgba
    pSkp2->DrawMeshGroup(hMesh, 0, SMOOTH_SHADE);

    // Reset to default world transform
    pSkp2->SetWorldTransform();
}

//  ---- Cleanup Code ----

if (hMesh) {
     gcDeleteSketchMesh(hMesh);
}
(Jarmonik's code explanation above)

I've tried several meshes and it always CTDs between DrawMeshGroup() and SetWorldTransform(). Nothing obvious appears in the log. I also played with the parameters of gcWorldMatrix() with no success, which is not really surprising because I'm not really sure of what they do. Are W and H the width and height of the render rectangle that will appear on the surface? And if I understand the comment about the clip planes, W and H also control how much of the mesh will show... any way to decouple that? Because if I want to display a 55px diameter disc of a 78px diameter ball (so just a part of the front of the ball), and if 0,0 is between the view point and the ball surface, the "zFar" clip would be in the far side of the ball...
It looks +/- obvious that the x and z parameters control the rotation and the scale parameter controls the size, but what is the meter-to-pixel conversion "ratio"? For example, a 1 meter diameter ball mesh, at scale = 1, would be displayed as how many pixels across?
Also, I need to select a white pen before the DrawMeshGroup() call so the mesh colors don't get messed up, right?
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
I've tried several meshes and it always CTDs between DrawMeshGroup() and SetWorldTransform(). Nothing obvious appears in the log. I also played with the parameters of gcWorldMatrix() with no success, which is not really surprising because I'm not really sure of what they do.

Sorry, that code is a bit old. You should you DrawSketchMesh() instead of DrawMeshGroup(). The later uses a MESHHANDLE from oapiLoadMeshGlobal() which isn't compatible with SKETCHMESH


Are W and H the width and height of the render rectangle that will appear on the surface? And if I understand the comment about the clip planes, W and H also control how much of the mesh will show... any way to decouple that?

It is possible to decouple that if there is a need. zFar = max(W,H) where W,H are the render surface size, not the values passed to gcWorldMatrix.

Because if I want to display a 55px diameter disc of a 78px diameter ball (so just a part of the front of the ball), and if 0,0 is between the view point and the ball surface, the "zFar" clip would be in the far side of the ball...
In that case you want z-coordinate for the matrix that is MAX(W,H) + sqrt((78/2)^2 - (55/2)^2), it should place the ball so that the back clip plane clips the section you want.

It looks +/- obvious that the x and z parameters control the rotation and the scale parameter controls the size, but what is the meter-to-pixel conversion "ratio"? For example, a 1 meter diameter ball mesh, at scale = 1, would be displayed as how many pixels across?
There are no meters it's all specified in pixels by default. If the ball's diameter in the mesh is 1.0f then the scale would need to be 78.0f

Also, I need to select a white pen before the DrawMeshGroup() call so the mesh colors don't get messed up, right?
Yes, that would be correct.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,917
Reaction score
2,921
Points
188
Website
github.com
A small request: could gcLoadSketchMesh() return NULL if it doesn't find the mesh? I just noticed it returns "something", and then when that "something" is used -> CTD.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
A small request: could gcLoadSketchMesh() return NULL if it doesn't find the mesh? I just noticed it returns "something", and then when that "something" is used -> CTD.

This will be fixed in next build.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Greetings jarmonik.

Thank you for all your good work - the visuals are great!

Can I ask what coding you use to get the external hull burn up effect at > mach speeds?
I want to sync it with visual and audible warnings in vc but can't quite get it to match.

Thanks in anticipation.
J.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
Can I ask what coding you use to get the external hull burn up effect at > mach speeds?
I want to sync it with visual and audible warnings in vc but can't quite get it to match.

I guess there should be better way to do this than matching codes but here it is:

PHP:
double p = vessel->GetAtmDensity();
double v = vessel->GetAirspeed();

float lim  = 100000000.0;
float www  = float(p*v*v*v);
float ints = max(0,(www-lim)) / (5.0f*lim);

if (ints>1.0f) ints = 1.0f;
if (ints<0.01f) return;
 

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,

I tried to link a project, which uses Sketchpad2, but it got linker errors. It seems that you forgot to distribute the Sketchpad2's import library. Its symbols aren't present in gcAPI.lib
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Hi Jarmo,

I tried to link a project, which uses Sketchpad2, but it got linker errors. It seems that you forgot to distribute the Sketchpad2's import library. Its symbols aren't present in gcAPI.lib

Shouldn't the header file(s) and the lib be enough to link?
 

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?
It would be, if the Sketchpad2's symbols were present in the gcAPI.lib
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
Shouldn't the header file(s) and the lib be enough to link?

That should be enough. Technically, the header alone should work too.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
@enjo:
Ah I see... dumpbin /SYMBOLS does help ;)

I've tried a fix in the project file, but before I commit, could you check if these (attachment) are O.K.?
 

Attachments

  • lib.zip
    36.9 KB · Views: 7

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
I still don't quite follow what's the problem with symbols ? My test apps are working fine and the Sketchpad2 is also used in SSU project without problems.

Sketchpad2 functions are defined/declared in the header:
PHP:
virtual void SetViewMode(SkpView mode = ORTHO) { assert(false); }

EDIT: Also the gcAPI_dbg.lib is obsolete no such thing is needed.
 

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?
@enjo:
Ah I see... dumpbin /SYMBOLS does help ;)

I've tried a fix in the project file, but before I commit, could you check if these (attachment) are O.K.?

Still somehow the number of missing symbols got greatly reduced with kuddel's build. Now I get only this:
Code:
||=== Build: ReleaseBETA in TopoMapMFD (compiler: Microsoft Visual C++ 2005/2008) ===|
gcAPI.lib(gcAPI.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1900' encountered; ignored|
gcAPI.lib(gcAPI.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=0' encountered; ignored|
gcAPI.lib(gcAPI.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:RuntimeLibrary=MT_StaticRelease' encountered; ignored|
gcAPI.lib(gcAPI.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0' encountered; ignored|
TopoMap.obj||warning LNK4217: locally defined symbol ??_7Sketchpad2@oapi@@6B@ (const oapi::Sketchpad2::`vftable') imported in function "public: void __thiscall TopoMap::Draw(class oapi::Sketchpad *)" (?Draw@TopoMap@@QAEXPAVSketchpad@oapi@@@Z)|
gcAPI.lib(gcAPI.obj)||error LNK2019: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))" (??_M@YGXPAXIIP6EX0@Z@Z) referenced in function "public: virtual void * __thiscall oapi::Sketchpad2::`vector deleting destructor'(unsigned int)" (??_ESketchpad2@oapi@@UAEPAXI@Z)|
gcAPI.lib(gcAPI.obj)||error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z) referenced in function "public: virtual void * __thiscall oapi::Sketchpad2::`vector deleting destructor'(unsigned int)" (??_ESketchpad2@oapi@@UAEPAXI@Z)|
gcAPI.lib(gcAPI.obj)||error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *,unsigned int)" (??_V@YAXPAXI@Z) referenced in function "public: virtual void * __thiscall oapi::Sketchpad2::`vector deleting destructor'(unsigned int)" (??_ESketchpad2@oapi@@UAEPAXI@Z)|
gcAPI.lib(gcAPI.obj)||error LNK2019: unresolved external symbol __ftoui3 referenced in function "unsigned long __cdecl gcColor(union oapi::FVECTOR4 const *)" (?gcColor@@YAKPBTFVECTOR4@oapi@@@Z)|
..\..\..\Orbiter\orbiterBETA\Modules\Plugin\TopoMapMFD.dll||fatal error LNK1120: 4 unresolved externals|
||=== Build failed: 5 error(s), 5 warning(s) (0 minute(s), 0 second(s)) ===|
 
Top