Jump to content
  • Advertisement
Sign in to follow this  
TFS_Waldo

[.net] C#-based OpenGL Engine?

This topic is 4521 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

Okay, I just have a quick question. But first, a couple of friends and I are wanting to start on a 3D engine. I mean, it's not going to be perfect. And I already know how to create a basic engine. That's all we're looking for. But I was wondering if C# would be a good language to create a 3D OpenGL engine. I mean, would it be more effective? Or should we stick with C++ on this one? I'm leaning more toward C++, because I've used it the longest. But I am working on C#, and we're willing to learn as much as we can if C# is a better choice. I just wanted everyone's opinion, as far as performance, etc. goes between C++ and C#. I hope I gave enough detail. And if C#, then what will I need to create an OpenGL application? Thanks in advance, Matt U.

Share this post


Link to post
Share on other sites
Advertisement
C++ will definantly give you better performance, but C# will allow you to develop your engine faster because there is less base that you have to put into C#.

Share this post


Link to post
Share on other sites
Quote:
Original post by gonzo
C++ will definantly give you better performance, but C# will allow you to develop your engine faster because there is less base that you have to put into C#.
That's partly incorrect. There have been many P/Invoke tests done that prove that the performance boost from using C++ is very insignificant. I'm currently working on a 2D OpenGL engine using a large chunk of the Tao Framework and I'm getting halariously high framerates:



Of course the 870 FPS is with only one sprite and a written string showing the FPS. But even with a tile map being rendered I'm still getting ~600 FPS, and that's in Debug mode too. Even if the hit becomes noticable, I think the benefits of using the .NET Framework outweigh that minor framerate hit. You're still going to get over 60 frames per second, anything over that surely isn't noticable.

Share this post


Link to post
Share on other sites
I dunno about 870, but with DirectX, physics and collisions I get around 5000fps in debug mode... So I think C++ is just silly for a single developer. :)

Share this post


Link to post
Share on other sites
C# is fine. It might be a little trickier to get updated opengl bindings than it would if you were using c++. I've used the Tao bindings, and they worked fine, but I never got the vertex/pixel shader extensions working. Of course that was 2 years ago, so they're probably in there now.

As far as performance, c# will be fast enough. In terms of just calling into DX/OpenGL, there is a very minimal overhead(as Rob pointed out). It's a little harder to do things like use SSE intrinsics in c#, though, so if you're planning in doing hardcore physics calculations I'd recommend c++. Of course, you can always put that in a separate library, and then have a managed wrapper which can be called by your c# code - it's very slick.

Share this post


Link to post
Share on other sites
Well, I'm not looking for TOP performance. I am just looking for something that will help me gain more "experience" (I guess you'd call it =P). I mean, I just want to do this to learn C# altogether.

But would you all recommend C++ or C#? I haven't used C# (or any .NET) for very long. But I need to get at least a little more up-to-date. I have been using VS 6.0 (VC++ 6) for about 3 years now.

And I don't have .NET 2005, but I do have .NET 2003. They're close enough, right? LoL.

And I currently have an older video card that doesn't support vertex/pixel shaders. But soon, in about a month, I should have at least a GeForce FX 5500 or 6800 for my machine. I have been wanting to get into vertex/pixel shader programming for a while, once I get a better grip on DX.

I just want to know, if I'm looking to learn something new, I should go with C#, right? I am about intermediately skilled in OpenGL in C++. I'm not the greatest, but I know enough to get by with a simple game, 2D or 3D.

I was just looking for opinions. That's all. Sorry if I repeated myself at all. LoL. =)

Thanks in advance,
Matt U.

Share this post


Link to post
Share on other sites
Well I can tell you through personal experience of making my 2D engine that I am exploiting and learning all of C# 2.0 to make my job easier. I really have learned a lot about generics, singletons, large software testing and maintenence, etc. C# is very effective in making my life easier, afterall I do not have to even begin to deal with pointers. But that is a small point for some... I will just say that with C# life seems more structured, error messages make more sense and blah blah blah... sorry, bit tired right now. My vote is for C#. But make sure you know C++ since it is the industry standard.

Share this post


Link to post
Share on other sites
TFS_Waldo,

As Rob said earlier, performance difference is minor - mostly at startup and then some residual stuff later on due to the CLR's memory management, etc...So dont let performance problems be the reason you dont use C#.

Additionally, C# will definately speed up your development time with advanced classes for containers, arrays, windows development, debugging, etc...

Finally, you can download the Visual Studio .NET 2005 Express edition free of charge from microsoft's site. If you'll be using the .NET framework, save yourself some headaches and make sure to use VS.NET 2005 with .NET 2.0

Cheers!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Although C# will not introduce much overhead, my reasons for not using it is that everyone does not have the .NET framework installed. Plus there are a couple of versions of this framework that also might not be installed. I will say that when I2 used C# that I was very productive. However, I used it for forms only so it was quite the upgrade over MFC and such, more like VB style double click ont hings and magic happens. The few demos that used .NET for me simply dont work, because the framework on every computer I have ever randomly been on never had it (or not the correct version), so I never played with any of those demos. That is my main reason for not using it currently. Its a back compatability issue that I feel still needs attention. You should however learn it, either way - as this industry changed rapidly and everyone seems to be on the C# bandwagon. To me it seems like a great tool for editors and such, since you can make a GUI quickly and easily.

Share this post


Link to post
Share on other sites
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!