Posted Wednesday, 18 March, 2009 - 01:42 by JTalton
OpenTK is a C# wrapper around OpenGL and OpenAL and would not be good to use from C++.
If you want to use C++ with OpenGL or OpenAL there are plenty of tutorials on the net.
Posted Wednesday, 18 March, 2009 - 08:43 by the Fiddler
To use OpenTK from C++ you'll have to use the C++/CLI dialect. Unfortunately, only Microsoft provides a C++/CLI compiler and the resulting code will only run on Windows (which negates one of the main benefits of OpenTK).
Here is a rough outline of a simple OpenTK program:
Import the OpenTK namespace and inherit a class from OpenTK.GameWindow.
In your new class, override the OnLoad, OnUpdateFrame and OnRenderFrame methods.
In your main method construct a new instance of your inherited class and call the Run method.
I wish I could help you with actual code, but I have never used C++/CLI. If you are familiar with the dialect it should be relatively easy to translate that into code. Don't hesitate to ask if you need more details.
Comments
Re: C++ with OpenTK
OpenTK is a C# wrapper around OpenGL and OpenAL and would not be good to use from C++.
If you want to use C++ with OpenGL or OpenAL there are plenty of tutorials on the net.
Re: C++ with OpenTK
@Zhaoguang - try with the Simple Directmedia Library for c++ and OpenGL. For OpenAL, I don't know.
Re: C++ with OpenTK
To use OpenTK from C++ you'll have to use the C++/CLI dialect. Unfortunately, only Microsoft provides a C++/CLI compiler and the resulting code will only run on Windows (which negates one of the main benefits of OpenTK).
Here is a rough outline of a simple OpenTK program:
OpenTK.GameWindow.OnLoad,OnUpdateFrameandOnRenderFramemethods.Runmethod.I wish I could help you with actual code, but I have never used C++/CLI. If you are familiar with the dialect it should be relatively easy to translate that into code. Don't hesitate to ask if you need more details.