This is a mirror of official site: http://jasper-net.blogspot.com/

Basic Shapes - C# OpenGL

| Tuesday, December 21, 2010
In this tutorial, we are going to learn how to create basic shapes in c# using OpenGL. First, we are going to create a new Project and a new Console Application. It's important that we should have the dynamic libraries in order to use OpenGL . We are going to add this in our project:

image1.gif

We have two variables that specify an angle and a camera angle, we are going to use them for the different perspective in our program, and both are float variables.

We are going to create a method called 'dibuja' in which we'll create our different shapes and specify color and size.

This sentence is use in order to clean the screen buffer..

Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
The next two sentences are important in OpenGL

Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity();          

Then, we specify the perspective…

Glu.gluPerspective(45.0, 1.0, 1.0, 500.0);

And the color, as we know, the colors in the computer are handleled like RGB (Red-Green-Blue), and in the sentence thats exactly the value that we are going to specify in the parameters…
Gl.glColor3f(0.5f, 0.9f, 0.9f);

Read more: C# Corner

Posted via email from .NET Info

0 comments: