Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Is there free OpenGL support libraries for C#? If so, which one do I use and where do I find sample projects?
Does C# provide classes for OpenGL?
OpenTK is an improvement over the Tao API, as it uses idiomatic C# style with overloading, strongly-typed enums, exceptions, and standard .NET types:
GL.Begin(BeginMode.Points);
GL.Color3(Color.Yellow);
GL.Vertex3(Vector3.Up);
as opposed to Tao which merely mirrors the C API:
Gl.glBegin(Gl.GL_POINTS); // double "gl" prefix
Gl.glColor3ub(255, 255, 0); // have to pass RGB values as separate args
Gl.glVertex3f(0, 1, 0); // explicit "f" qualifier
This makes for harder porting but is incredibly nice to use.
As a bonus it provides font rendering, texture loading, input handling, audio, math...
Update 18th January 2016: Today the OpenTK maintainer has stepped away from the project, leaving its future uncertain. The forums are filled with spam. The maintainer recommends moving to MonoGame or SDL2#.
Update 30th June 2020: OpenTK has had new maintainers for a while now and has an active discord community. So the previous recommendation of using another library isn't necessarily true.
I think what #korona meant was since it's just a C API, you can consume it from C# directly with a heck of a lot of typing like this:
[DllImport("opengl32")]
public static extern void glVertex3f(float x, float y, float z);
You unfortunately would need to do this for every single OpenGL function you call, and is basically what Tao has done for you.
Tao is supposed to be a nice framework.
From their site:
The Tao Framework for .NET is a collection of bindings to facilitate
cross-platform media application development utilizing
the .NET and Mono platforms.
SharpGL is a project that lets you use OpenGL in your Windows Forms or WPF applications.
You can OpenGL without a wrapper and use it natively in C#.
Just as Jeff Mc said, you would have to import all the functions you need with DllImport.
What he left out is having to create context before you can use any of the OpenGL functions. It's not hard, but there are few other not-so-intuitive DllImports that need to be done.
I have created an example C# project in VS2012 with almost the bare minimum necessary to get OpenGL running on Windows box. It only paints the window blue, but it should be enough to get you started. The example can be found at http://www.glinos-labs.org/?q=programming-opengl-csharp. Look for the No Wrapper example at the bottom.
I would also recommend the Tao Framework. But one additional note:
Take a look at these tutorials:
http://www.taumuon.co.uk/jabuka/
What would you like these support libraries to do? Just using OpenGL from C# is simple enough and does not require any additional libraries afaik.
Concerning the (somewhat off topic I know but since it was brought up earlier) XNA vs OpenGL choice, it might be beneficial in several cases to go with OpenGL instead of XNA (and in other XNA instead of OpenGL...).
If you are going to run the applications on Linux or Mac using Mono, it might be a good choice to go with OpenGL. Also, which isn't so widely known I think, if you have customers that are going to run your applications in a Citrix environment, then DirectX/Direct3D/XNA won't be as economical a choice as OpenGL. The reason for this is that OpenGL applications can be co-hosted on a lesser number of servers (due to performance issues a single server cannot host an infinite number of application instances) than DirectX/XNA applications which demands dedicated virtual servers to run in hardware accelerated mode. Other requirements exists like supported graphics cards etc but I will keep to the XNA vs OpenGL issue.
As an IT Architect, Software developer etc this will have to be considered before choosing between OpenGL and DirectX/XNA...
A side note is that WebGL is based on OpenGL ES3 afaik...
As a further note, these are not the only considerations, but they might make the choice easier for some...
XNA 2.0 requires a minimum of a shader 1.1 card. While old tech, not everyone has one. Some newer laptops (in our experience Toshiba tablets with Intel graphics) have no shader 1.1 support. XNA simply wont run on these machines.
This is a significant issue for us and we have shifted to Tao and OpenGL. Plus with Tao we have bindings for audio & Lua support.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm currently learning C# with Visual Studio Express 2012, and I have a few game ideas for the future. I just have trouble figuring out how to start (I'm 15) and I was wondering what would be a nice game engine for that sort of game.
XNA would be perfect for this, although if you want to use .NET 4.5 you will have to go through some minor annoyances to get it running in visual studio 2012 and .net 4.5
Another (better in my opinion) alternative is SharpDX. SharpDX is primarily a very well built managed DirectX API, built directly from the header files of the native DirectX. SharpDX includes a collection of additional assemblies called "Toolkit.{namespace name here}" that provide exactly what XNA provided, but in most cases, much more ideal. Should be noted that the toolkit class designs were based off the structuring of the XNA framework. SharpDX will require you to have an understanding of DirectX to take full advantage of it's capabilities, but you won't find this much capability in ANY other managed DirectX wrapper. Period (yes that's counting SlimDX as well).
Monogame (Mono's version of XNA is another solution, that for the moment, supports even mobile and Windows 8). Monogame has a nice bonus to it: It has nice support for cross-platform development. However, that bonus is also it's downside. Due to it's internal structuring, it's performance is poor compared to other options.
As mentioned in a comment, Unity is another popular option. You write in c# and support for javascript as well. Personally, I see a lot of future potential for Unity.
Just a note about XNA if you go that route: XNA is dead. Microsoft will not be supporting it after next year I believe they said. To be honest, windows 8 game development in c# has been somewhat left out in the cold at the moment (with the exception of Mono's version of XNA). Be warned about Mono though, although it works well, functionally speaking, it's performance is horrid (despite what mono-lovers will say). If you don't believe me, check the source code of it for yourself.
Another emerging popular choice is HTML5 and javascript. Seriously. You can do some absolutely astonishing javascript graphics with libs like three.js on an html5 canvas. Much more than I would have expected for a scripting language.
And on a final note, the old tried and true c++ and DirectX/OpenGL. C++ is by far the most powerful of the programming languages and for this reason it is the most heavily used in game development. Unfortunately, it is also the most difficult to become efficient in and the concepts involved in creating a fully-functional game can take years to master even. Correction, it WILL take years. However, it's the most rewarding choice in the end.
XNA and Unity are definitely the way to go, for new programmers to learn about game programming.
Also pay attention to the basic algorithms and data structures you learn in school. Another common method of learning game programming, back in my day, was to download, edit and run a MUD.
Have a look at http://www.waveengine.net/
It's awesome that you are into game dev already!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am creating a 2D game which I wish to run cross platform (on platforms such as Windows, Mac, iOS and Android as the main targets) and the engine I use needs to be open source.
The main goal is to have the most code portability (possibly through scripting).
I would prefer to do this in C# but using another language is not a massive issue if I have to.
I have considered MonoGame and flash using the Flex SDK as they both claim to be cross platform and open source.
Which one of these would be a better choice considering my criteria? Or would another game engine/library be more suitable?
I would suggest Unity3D. It is a 3D platform. But if you only use 2 dimensions you're good to go. In Unity3D you can write your game in C#, Javascript or Boo.
Unity is free and can export to Windows Phone, Windows 8 App, Windows, Mac, Linux, Android, Blackberry, iOs, Xbox360, Wii and PS3 but for those last 3 you need a developer license from Microsoft/Sony/Nintendo. But the possibility is there.
UPDATE
You had to pay for the ios and android addons earlier. Now they are free:
Today, we’re taking another step on this long road: as of right now,
independent Unity developers will be able to deploy their games to
Android and iOS platforms completely free of charge. Update Unity and
you will find Android and iOS build options (previously basic add-ons)
ready and waiting for you to use.
Source: http://blogs.unity3d.com/
In the meanwhile, support for other platforms has come out (including windows phone, winrt & blackberry). Those are all free. If you want pro features you need a pro license. But most of the stuff you need is in the free version. To compare look at this page.
The engines below allow you to reuse pretty much all your code, only thing you need to change is resolution and touch input/controls from desktop to mobile or the other way around. I would suggest you check out these engines, they are all open source:
libgdx - Uses Java and is almost as fast as XNA, but faster than MonoGame. "Publish your games on Windows, Mac, Linux, Android, iOS and HTML5, all with the same code base." - off their website, anything that can run java, can run your game. Big community so you shouldn't have problems asking questions when you need help and getting it.
Qt-Project - Qt is a cross-platform application and UI framework for developers using C++ or QML, a CSS & JavaScript like language. As of Qt 5.1 you are supposed to be able to build for Android and iOS, allowing you to build for all the platforms you requested. Big community.
Moai - Uses Lua and can deploy to all the platforms you requested. Only downside is the community is pretty small and the docs are a little out of date, but people on irc and forums will usually help you, but the answer won't always be immediate. You also have to build your own hosts to build for the platforms you desire, but last time I checked there were public hosts for all platforms out.
libgdx seems like a perfect fit for you. the performance is amazing, the community is big and it lets you reuse the same code for all platforms, just to name a few. Only downside being it doesn't use C#. Of course you should definitely look into them yourselves and see if they are match for what you want. I wish you the best of luck in your endeavors.
There are a couple of options based on your preferences; I will list a couple of ones I recently come across.
Cocos2d series seem very popular these days. If you think C++ isn't
a problem for you then Cocos2d-X would be an option as it offers a
lot of platforms. Other Cocos2d series might get your attention as
well. I guess there are a couple of versions like HTML5, Javascript,
Python. etc but i think only cocos2d-x is cross platform.
Unity3D(C#, Javascript, Boo) seems as an option but it's not open
source, as well as UDK(UnrealScript) also same, but if you think to
buy a license they offer source code I guess
Flash also can be a good option, as you mentioned. It uses AS3 which
is an OOP language and can be very useful if you are a beginner.
And ImpactJS offers a lot of platforms also, it uses HTML5, you can
check here http://impactjs.com/
The list can be longer and longer, and depends on your needs. You should specify your needs clearly like; how much deep you wanna go, which platforms are most important for you? etc.
Good Luck
You can try this: http://www.appgamekit.com/ (AGK)
Code in c++, but working perfectly. A very simple engine.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have been learning C# for a time now. I basically come from a non-developing background (means I dont know the actual working of different programming tools). I just started learning Monogame but few things confused me.
Firstly it says that Monogame is open-source implementation of XNA. What does it mean?
-that it makes XNA open-source
-or takes features of XNA and implements it itself but with same function names etc. as XNA
-any other
And is it allowed and legal? If yes, can I copy any app in any app store and make my own version? What needs to be different for it to be legal?
Secondly when I installed Monogame, SharpDX was also installed. When I searched about it, I found that SharpDX is managed DirectX (I have never worked in DirectX). What is the link between Monogame and SharpDX (or XNA and DirectX) and cant I use monogame or SharpDX separately? And what does it mean by managed DirectX?
Thirdly are there more cross-platform C# frameworks other than those provided by Xamarin? I cant find more.
What does it mean?
Monogame is another implementation (same interface, different underpinnings) of XNA
And is it allowed and legal?
I don't know XNA's terms offhand, but typically Microsoft allows duplicates of this sort (see the original Mono). You can do research on the license for XNA if this concerns you.
Can I copy any app in any app store and make my own version? What needs to be different for it to be legal?
I am not a lawyer (especially not a copyright lawyer), a couple of things to steer you in the right direction, mostly it boils down to copies ideas is fine, copying anything concrete is not.
Making a match 3 game - Okay
Using images from Candy Crunch - Not okay
Decompiling Angry Birds and using their physics engine directly - Not okay
Playing around with Angry Birds and duplicating the physics engine - Okay
So if you wrote it and were inspired that is fine, but if you take it that is not fine. Also note that there is a significant grey area when it comes to decompilation so I wouldn't do anything related to that if you want to sell your product. (Or even put it on an app store)
On a less objective note, don't try and copy something directly, if it is popular you won't replicate that success just by being the same. Find an idea you like and tweak it to make it more interesting at the least.
What is the link between Monogame and SharpDX (or XNA and DirectX) and cant I use monogame or SharpDX separately?
Monogame probably uses SharpDX on Windows and/or XBox (both of which have DirectX as an option). SharpDX is an externally maintained managed interface to DirectX. Rather than redoing that work they use it. Whether you need it depends on your platform. It would be useless on Android or iOS for instance, since neither of those platforms supports DirectX.
Thirdly are there more cross-platform C# frameworks other than those provided by Xamarin?
You need to define framework and probably cross-platform if you want an answer to this question. For instance Mono is basically the only cross-platform framework by using the .NET Framework definition of framework.
Firstly it says that Monogame is open-source implementation of XNA. What does it mean? -that it makes XNA open-source -or takes features of XNA and implements it itself but with same function names etc. as XNA -any other
Let's start at the beginning. To fully answer your questions you'll need to understand a bit of history.
Firstly, XNA is a set of tools provided by Microsoft that facilitates video game development. XNA is based on the .NET Framework, with versions that run on Windows, Windows Phone and XBox.
MonoGame is an open source implementation of XNA with the goal of making it truly multi-platform. It allows existing XNA developers to port their games to many other platforms using nearly identical code. So while developers used to be restricted to only Microsoft platforms they can now also deploy games on iOS, Android, Mac OS X, Linux, Windows 8 Store, Windows Phone 8, PlayStation Mobile and OUYA.
The other important thing to realise is that Microsoft is no longer supporting XNA in the future. MonoGame has become a very attractive replacement for XNA developers even for Microsoft platforms.
And is it allowed and legal?
That's a good question. While it may seem on the surface to be potentially dangerous ground, and I'm no lawyer, there appears to be plenty of evidence that Microsoft is okay with it.
For example, Skulls of the Shogun was developed using MonoGame, published by Microsoft and released on Xbox, Windows 8 and Windows Phone 8.
There are also some other examples, like TY the Tasmanian Tiger and Lee Stott (Microsoft UK Evangelist) talking about MonoGame.
can I copy any app in any app store and make my own version? What needs to be different for it to be legal?
No. You can't just copy an existing app. You'll quickly run into copyright and trademark law infringements if you do this. Even if you create a game with too many things similar to an existing game it can upset people and you may find yourself in some trouble. Believe me, I've had to deal with this before and it's not fun.
That said, copyright law can't prevent you from making your own games if you have some originality and creativity.
"Copyright does not protect the idea for a game, its name or title, or the method or methods for playing it. Nor does copyright protect any idea, system, method, device, or trademark material involved in developing, merchandising, or playing a game. Once a game has been made public, nothing in the copyright law prevents others from developing another game based on similar principles. Copyright protects only the particular manner of an author’s expression in literary, artistic, or musical form." - http://www.copyright.gov/fls/fl108.html
If you think you might be at risk I suggest doing some reading.
Secondly when I installed Monogame, SharpDX was also installed. When I searched about it, I found that SharpDX is managed DirectX (I have never worked in DirectX). What is the link between Monogame and SharpDX (or XNA and DirectX) and cant I use monogame or SharpDX separately? And what does it mean by managed DirectX?
DirectX is an API for handling tasks related to game development on Microsoft platforms.
SharpDX is a layer that sits on top of DirectX to allow it to be used in managed languages like C#.
OpenGL is an API for handling tasks related to game development on non-Microsoft platforms.
OpenTK is a layer that sits on top of OpenGL to allow it to be used in managed languages like C#.
MonoGame uses SharpDX on Microsoft platforms and OpenTK on non-Microsoft platforms.
(actually, it's not that simple but you get the idea)
Thirdly are there more cross-platform C# frameworks other than those provided by Xamarin? I cant find more.
Xamarin has pretty much cornered the market in the multi-platform C# area. The only other option I can think of is Unity but it's not really a framework, it's a full game engine.
I'm a student, and for my next job, I have to program a module which is very similar to the features of the VTK (http://www.vtk.org/VTK/project/imagegallery.php).
I've had some success with the vtk, but now we're having problems, that not even my boss can solve. I want to try my luck with learning one of the frameworks listed above.
Which one would be the best for my project? I'm using C# and read about dx, that the managed variant will no longer be supported. And XNA is more specialized for game development, isn't it? Will openGL also be used in the future? I don't want to learn the language for nothing... I would also want to develop some little game projects at home and put it to my curriculum vitae.
So at the moment I'm confused, maybe someone here can help me with my decision.
VTK uses OpenGL. OpenGL is common in research and CAD-style professional modeling packages, as well as id Software games and games running in Mac OS X natively. This includes the Source engine (Half-Life 2) and World of Warcraft. It has the benefit of being cross-platform.
DirectX is very popular for game development on Windows and Xbox 360, although it is also used for scientific visualization. XNA is a managed framework build over DirectX to make it easier to make games. If you want to use C# to write scientific applications, you might consider SlimDX, which is an open-source replacement for Managed DirectX. DirectX and related technologies only run on Microsoft OSs.
Even though this is not strictly game-related, you might have more luck having this question answered at: https://gamedev.stackexchange.com/
Personally, if I had to use C# to get this job done I would use the XNA framework even though it is designed more for games (although there are some difficulties integrating it into Windows Forms).
You could also consider WPF since that has a capable 3D renderer too.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've seen there are a few of them. opencvdotnet, SharperCV, EmguCV, One on Code Project.
Does anyone have any experience with any of these? I played around with the one on Code Project for a bit, but as soon as I tried to do anything complicated I got some nasty uncatchable exceptions (i.e. Msgbox exceptions). Cross platform (supports Mono) would be best.
I started out with opencvdotnet but it's not really actively developed any more. Further, support for the feature I needed (facedetection) was patchy. I'm using EmguCV now: It wraps a much greater part of the API and the guy behind it is very responsive to suggestions and requests. The code is a joy to look at and is known to work on Mono.
I've wrote up a quick getting-started guide on my blog.
We use OpenCVSharp the google code website is in Japanese but it uses the latest OpenCV builds and impliments IDisposable throughout. It seems to provide more functioanlity than any of the others we have seen to date and is still active. It has quite extensive example programs as well.
NuGetMustHaves has a good summary of packages on NuGet with their build dates and OpenCV revs.
As of 1/24/2023:
EmguCV is updated for OpenCVv 4.6.0.5131
OpenCvSharp is updated for OpenCV v4.7.0.20230115
EmguCV and OpenCvSharp are the 2 packages with recent builds and appear to be the better choices going forward.
Beware, EmguCV uses a dual GPL3/Commercial license (source) whereas OpenCVSharp uses the BSD 3-Clause License. In other words, OpenCVSharp is free for commercial use but EmguCV is not. EmguCV has superior documentation/examples/support and a bigger development team behind it, though, making the license worthwhile in many cases.
It's worth considering what your future use cases are. If you're just looking to get running quickly using a managed language, the wrappers are fine. I started off that way. But as I got into more serious applications, I've found building a python/C++ application has better performance and more potential for reuse of code across platforms.
I think it's important to note that the original question was asked in 2008, and OpenCV 2.0 was released in 2009. The version 2.0 release introduced a C++ wrapper which is significantly easier to work with than the older C interface that the OP was confronted with. For my .NET project, I'm leaving all the graphic manipulation in native C++.
Try this: create a C++/CLR DLL project which links to the OpenCV libraries. The OpenCV manual describes how to do this for a Windows C++ EXE, the same steps also work for a C++/CLR DLL. Then of course the DLL exports methods which are callable from a .NET EXE.
To test it, you should be able to incorporate any of the OpenCV samples into your DLL with a little tweaking. (Add the .CPP file to your project, convert the main() function to a class member, etc. - you know the drill...) A good test candidate might be the "mat_mask_operations" sample.
I think best wrapper is opencvsharp
http://code.google.com/p/opencvsharp/
I created a NuGet Package to make easy to start with OpenCv in C#, using EmguCV.
Check it out!
In Visual Studio search and add the myEmguCV.Net NuGet package.
https://www.nuget.org/packages/myEmguCV.Net
SharperCV was our tool of choice, and it doesn't let us down, for our robotics project. Even though it is currently marked as abandoned, the code is in really good shape, requires only minor tweaking to customize it for your need. No msgboxes, and actually very sane exception handling.
Not cross-platform, though, due to the interoperability layer.
I know this question has been answered for a long time, but I would like to add that there is a very good wrapper here. This is the new version of the openCV wrapper that you tried on code project. I've tried it for a couple of days and everything works perfect. Also, I got it working in minutes.
I don't know for the compatibility with mono but under Visual Studio 2010, it works like a charm and saved me ton's of time and money (my project is commercial and most of the library are open source with licence that doesn't allow commercial utilisation unless publishing the code)