Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I read several different tutorials on how to get rendering to work from a C++/CLI to C#/WPF bridge using either OpenGL or DirectX, but I can only get the Grid area to clear and not draw geometry.

I have a custom game engine that has a dual-renderer (i.e. OpenGL 4.1 and DirectX 11) that works perfectly in a native C++ application. I tried to bridge the gap by creating a managed wrapper DLL for all the various functions and renderer.

I have checked the memory locations of each variable to ensure I was getting consistent results, and found that each and every variable all pointed to the correct location. Still only clears. Will not draw.

So, I figured that I would try to render something using the basic functions of OpenGL, i.e. glVertex3f(), etc. Still only clears.

To give a better idea of what I am doing specifically, I inherit from HwndHost to create a window that possesses a handle that I can then plug into the renderer to initialize it. I am able to load the various shaders, backbuffer, depth stencil, and viewport without any problems.

I am creating my own wrapper and refuse to use Tao, SharpDX, SharpGL, etc. to accomplish my needs as I prefer to use the engine's functions.

So my question is, what other ideas does anyone have about why a WPF window handle (grid) would not render geometry, but would otherwise clear?
Posted
Comments
Sergey Alexandrovich Kryukov 23-Aug-13 20:38pm    
"C++/CLI to C#/WPF bridge"?! What can you possibly mean by that? C++/CLI and C# are both .NET languages, and what is C#/WPF?
There are no need for a "bridge", and you cannot have any.

Now, there is no a sound question here, just a set of not really related words. If something "would not render", it means that you screw up something, but there are too many ways to screw up. There is nothing to help you with. If you could show a comprehensive code sample and steps to reproduce the problem, it would be a different story.

—SA
jmclaine 23-Aug-13 21:14pm    
I was just trying to see if anyone had any ideas about what could cause a simple object to not render to the window as I had tried everything I could think of at the time. What I mean by "bridge" is I wrote a game engine in C++ and created a wrapper of the code in CLI so it could be used within a C# / WPF application. Hence bridging the gap between C++ and C#.
Sergey Alexandrovich Kryukov 23-Aug-13 23:09pm    
You did not mention C++, you mentioned C++/CLI; there is no gap between it and C#. Yes, you can create a mixed-mode C++ and C++/CLI project, so what?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900