Jump to content
  • Advertisement
Sign in to follow this  
DoRsal

C++ to C# and vertexbuffer problem

This topic is 3990 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have developed a lib in C++ for a Particle System. I now need to use this particle system code in C# so I have created a DLL in c++ and a wrapper class in C# that uses the DLL. It works great for setting up a particle system with affectors and emitters etc. The problem is that I need to get the particle data into C# as well and this is not so easy. I belive some new design of the particle system for handeling the particle data should be good but I dont know how. Currently the particle data is stored in a list: list<Particle*> m_particles; and the Particle class have a bunch of variables like position, rotation, velocity etc. The update part of the particle system is quite fast but the rendering part is very slow since i just wrote some fast code to render it in DirectX9 by creating a quad that i transform and render for each particle using DrawPrimitiveUP(...) just to get the result. So what I want to do now is to create a vertexbuffer for the particle data and be able to send it over to C# through the DLL. My questions are: 1. How do I make a vertexbuffer in a good way for handeling particles and how do I update it? 2. How do I transfer the vertexbuffer data to C#? Some clarification on the DLL part: The c++ DLL looks something like:
extern "C"
{
	int PS_DECLSPEC test()
	{
		return 43;
	}
}
the C# code looks something like this:
class PSWrapper
{
    [DllImport("LasrodDLL.dll")]
    public static extern int test();
}
I need way to make a function that returns the data(probably the vertexbuffer) so that I can render the particles in C#.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!