Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Extra data from globstruct

Author
Message
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 3rd Oct 2009 17:19
Is there a way to retrieve some of the extra data located in the globstruct structure?

I am specifically after the value of dwCurrentSetCameraID for my plugin.

Also iCurrentBitmapNumber,pCurrentBitmapTexture, and pCurrentBitmapSurface would be handy.

I can't currently see anyway to get at these.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 3rd Oct 2009 19:49
Cloggy,

Cloggy, I'll write a small plugin that will give you access to this information. Modifying the class will allow you to get more detailed information from the structure. Gimme a little while and I'll post it up on here.

Paul.

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 4th Oct 2009 01:47
Paul,

You're a star! I look forward to progressing this forther.

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 8th Oct 2009 13:34
Paul,

I don't want to be a nuisance, but would you be able to knock up that plugin or maybe provide me with some sort of example?

I'm happy to do the work but don't know where to start.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th Oct 2009 14:12 Edited at: 8th Oct 2009 14:14
Hi Cloggy, I'll have it for you this evening. I made a start a couple of days ago, but got sidetracked with some family matters, but will post the plugin later this evening, is that ok?

[EDIT] I meant to ask also, do you have the C++ compiler as well as the standard .NET tools? Thing is, if you need to make changes to the plugin to allow further access to the structure, it'll be relatively easy to do this to the sample and recompile it.

Paul.

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 8th Oct 2009 14:23
Paul,

No worries, thanks for taking the time to look at this.

I have both VS2003 and 2008.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th Oct 2009 14:33
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 9th Oct 2009 03:35
Cloggy, I've not forgotten. Got held back at work this evening and didn't get home until around 8pm. I will get this sorted for you ok. Please forgive my indiscretion.

Paul.

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 9th Oct 2009 10:14
Paul,

No problem, you're doing me a favour here. I'm happy to wait.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 9th Oct 2009 23:16 Edited at: 9th Oct 2009 23:22
Cloggy,

Find attached, the plugin which contains a single method in the CGlobStruct class to return the iCurrentCameraID member of the GlobStruct structure.

Just add more methods as necessary to obtain the other members. The one thing that you may need to watch is, if you're going to return a pointer, you'll need to use the System::IntPtr type as the return value so that the value can then be passed to other functions which require the pointer address from with managed code.

I hope this is ok. Just build both projects and then reference the DGDKGlobStruct.DLL from within the sample project and run it.

It should display the value on the Windows GDK form control.

Sny problems or questions, let me know.

Paul.

[EDIT] You'll need the GlobStruct.h header file as well, if you don't have this, I'll email it to you.

Attachments

Login to view attachments
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 10th Oct 2009 01:15 Edited at: 10th Oct 2009 01:26
Paul,

Looks good, one question though. I'm also trying to return GetGlobStruct()->pCurrentBitmapSurface which is a LPDIRECT3DSURFACE9. What type should I return it as?

[Edit] - Seems like



works.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 10th Oct 2009 01:56
Yeah, that's what I thought that should be also. As long as the pointer value doesn't change, you can still pass it as an intptr to DirectX if it allows it.

Paul.

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 11th Oct 2009 21:51 Edited at: 12th Oct 2009 02:21
Paul,

Everything seems to be working great.

Currently I have created a version of my D3DFunc.dll that uses SlimDX and this is working fine.

What I would really like to do is create a wrapper for my D3DFunc.lib that is created for the GDK.

The problem I have is when I try to compile the plugin app with a call to my .lib I get a number of errors (see below) plus other similar errors.




The .lib works when called from the GDK, just not when compiled into you supplied plugin app.

Any ideas? I presume it is the way I'm compiling the original, but I'm not sure.

[EDIT] - My Library includes functions from the GDK. I think this is the problem. I need to compile the library with the same settings as the GDK libraries.

The other solution to this is if the following definitions which are missing from the GDK includes but are available from the libraries, could be made available in GDK.net. If they were included I could use my code as is and wouldn't need the SlimDX library.



Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 16th Oct 2009 01:12
I am now trying to convert my dll into the plugin format you provide. The problem is I want to use it in .net as follows



Am I trying to do the impossible, or just the very hard. Seems like the first to me

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 16th Oct 2009 02:29
Cloggy,

Technically, that's correct, but can you tell me what's happening? All I see, is your code instanciating the plugin class, and draw a dot. Is it failing for some reason?

I'll try to assist in getting it working.

Paul

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 16th Oct 2009 02:52 Edited at: 16th Oct 2009 10:56
Paul,

That is how I want it to work. Not sure how I structure the code in c++. Getting confused by nested classes and namespaces.

Here is what I've tried but can't work out how it should be coded to work.



Any help will much appreciated as always. All my c++ coding so far has been fudged on the fly from the web. I'm a basic man, very basic

[EDIT] - Just to clarify this. I have a class called D3DFunc, I want to have various Subclasses under this (Text,Draw3D,Draw2D,Core) some of these will also have subclasses (BatchDraw). I can't seem to add subclasses because it doesn't like me adding a subclass as shown in my code above as it complains with



I would also like to be able to create all of my subclasses in separate source files for tidyness.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 16th Oct 2009 21:42
Cloggy, I'll have a gander, but you'll definately need to place your classes into their own namespace so that you can have things like sub classes. They're not subclasses as such, but are contained within their own namespace to allow for larger interface design.

Paul.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Oct 2009 17:01
I like this discussion, it suggests we may get D3D for .net

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 17th Oct 2009 21:26
Batvink,

I've got a .Net version made using VB running using SlimDX, but I've been having problems getting to work on other computers even after installing the slimDX runtime

That's why I'm trying to get my original c++ code into a managed c++ dll.

Hopefully Paul can help as he obviously had to do something similar to get the DarkGDK libraries working in the first place.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 18th Oct 2009 00:41 Edited at: 18th Oct 2009 00:42
@Cloggy
You cannot put native classes inside a managed class.

You should put all the actual plugin code into native classes, which should be outside any managed classes. You should then create managed classes as wrappers to access the native classes from .net. (Also, you ca't have instances of native classes in managed classes, so you have to use pointers to any instances of native classes)

Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 18th Oct 2009 01:59
Diggsey,

I have been going at this 3 ways.

1) I have created a library D3DFunc.lib which I have been trying to wrap in the same way as the DarkGDK libraries are wrapped to create DarkGDK.Net. This fails because I am unable to compile any Plugin project that includes my library.

2) I have created a VB.net plugin using slimDX for all the directX functionality I need. This works but I would need to supply the slimDX redistributable and I seem to have a problem running any app that uses my plugin on 2 other PC's I have tested on.

3) My current attempt is to add all my plugin code into the Plugin template created by Paul. The problem here is that I want to be able to create a class called D3DFunc that has other namespaces for things like Text functions, 2D & 3D functions etc.

if I have a class setup like this



I can create an instance in VB like this.



But I want to be able to have all my 2d Drawing functions in their own namespace like this.



But I have no idea how to make this. If you can shed any light on how I should code this in my plugin I would be very happy.


APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 18th Oct 2009 04:05
Cloggy, tomrrow, I'll send you my CSMImporter.NET plugin project
This uses native classes, but has the .NET plugin class wrapped to call into the native functions. It's pretty much the same thing.

Paul.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 18th Oct 2009 15:22
Cloggy, I've sent you an email.

Paul.

Login to post a reply

Server time is: 2024-04-19 23:29:51
Your offset time is: 2024-04-19 23:29:51