- Install the Tao Framework, download it here.
- In VisualStudio.net Toolbox, add a new Tab and rename it with a meaningful caption:
- In the new Tab category, right click”Choose Items”:

- Browse to the control “SimpleOpenGLControl”

- Drag the control onto the Windows Form designer, this will automatically add two reference assemblies to the project:

- Using the object browser to have a closer look at the control, it shows that the class hierarchy is:
public class SimpleOpenGlControl : System.Windows.Forms.UserControl , Member of Tao.Platform.Windows
i.e. a user control. The class provides several virtual functions, which, you can inherit from it and override in order to perfom OpenGL renderings in your project.
- Now, compile the program and there will be no error, however, if you run it, you will see a messagebox. And to trouble shoot this, you need to add a few code lines.

- Add the following code first
using Tao.OpenGl;
using Tao.Platform.Windows; - And then, in the Form.Load event handler add the code below and rerun it, now it works!
glControl.InitializeContexts(); //Assuming that you have named the control “glControl”; - Now to render something, you can handle the OnPaint event of the control:

- Type the demo code to see the results:


With this, all your previous C++ OpenGL codes can be immigrated to C# with ease.
gaHcep
December 10, 2008 at 8:26 am
Thanks, tutorial is just in time
saintist
January 9, 2009 at 2:59 am
Very good sample, senk
Rajeev Lochan
February 15, 2010 at 1:09 pm
Thanks for the lovely tutorial on getting started with Tao Framework.
Rajeev
Dan
June 4, 2010 at 11:24 pm
I’ve followed this to the teeth and sadly it does not work, it only shows a white box where the “glControl” is located. I am using VS08, anything I’m missing?
xinyustudio
June 10, 2010 at 1:56 am
Dan,
If you could offer more details of the errors, I can help troubleshoot this. Check below:
+If you have coded some OpenGL actions;
+What OS are you using? English or other international languages?
+Can you successfully draw sth using C++?
xinyustudio
August 10, 2010 at 2:45 am
Update: the download link of Tao framework, previously no longer valid, is now corrected. You can directly download it using the link provided now.
10gler
September 24, 2010 at 7:52 pm
Hi,
You ilustrate than OnPaint event should handled to call render method. I have a question, when OnPaint is invoked by the control? I would like perform same animation so the render should be invoked (scene refreshed) in any possible time (very fast).
I added same thread to my program that call rener method. But somethimes I have collision (OnPain invoke render and my thread also).
Best regards
xinyustudio
September 24, 2010 at 8:14 pm
I suppose the OnPaint event of the control calls OpenGL funcions,instead of the opposite direction. Moreover, I am not very clear about your problem. You may refine your problem, and I will try to help.
10gler
September 25, 2010 at 12:56 am
Ok, I try to explain main problem.
In your example the triangle position is static. What sould be done rotate your triangle? (for example).
I put in my rendeering class variable angle and call a glRotatef(angle++, 1, 0, 0) before draw triangle but nothing happen (possiotion of triangle is static). So I debuged program and noticed that onpaint event is called “from time to time” maybe even ones.
10gler
September 25, 2010 at 1:15 am
In the and of onpaint event I call glControl.Draw(); method – now it works perfect and no extra rendering thred needed.
Is it correct way?
xinyustudio
September 26, 2010 at 3:36 pm
You may simply try calling refresh() method of the control? I guess it may work for your purpose.
10gler
October 12, 2010 at 5:12 am
Hi!
Is it possible to get source code of this control?
xinyustudio
October 12, 2010 at 8:49 pm
http://sourceforge.net/projects/taoframework/files/The%20Tao%20Framework/2.1.0/taoframework-2.1.0.zip/download
unzip and go to folder \source\
Mohammed Younus Ahmed
November 26, 2010 at 1:58 am
It will be better if some video is published in this regard. I am able to add the Tao Framework to Vs2010 but it never come in the list if .net components . Please help
syed sheheryar
July 7, 2011 at 6:42 am
Now waht to do IF I wanted to save the object craeted in a jpg file or image file .
kuzziunns
January 11, 2012 at 5:32 am
Thanx .y
Mahantesh
April 11, 2012 at 1:24 pm
I tried to add simpleopenglcontrol into my tool box but couldn’t find .so is there any mistake in installing it or any other problem?