File: Lesson02.cs

package info (click to toggle)
gtkglarea-sharp 0.0.17-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,148 kB
  • ctags: 492
  • sloc: sh: 3,376; cs: 2,633; makefile: 421; xml: 126
file content (46 lines) | stat: -rw-r--r-- 1,119 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// created on 12/13/2005 at 1:51 PM
using System;
using Gtk;
using GtkSharp;

using GtkGL;

using Tao.OpenGl;

using gl=Tao.OpenGl.Gl;
using glu=Tao.OpenGl.Glu;

// This code is based on work from Alp Toker and the NeHe lesson here:
// http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01
namespace NeHe
{
	public class Lesson02
	{
		public static int Main (string[] argc)
		{
			Application.Init ();
			
			GtkGL.GladeExample gladeWindow = new GtkGL.GladeExample();
			
	   		// Create a new Triangle object, translate it a bit and add it to our gl window
			Triangle triangle = new Triangle();
			triangle.Translate(-1.5,0.0,-3);
			gladeWindow.glw.AddGLObject( triangle );			

			// Create a new Square object, translate it a bit and add it to our gl window
			Square square = new Square();
			square.Translate(1.5,0.0,-3);
			gladeWindow.glw.AddGLObject( square );
			
			// Show GL Window
			// Is this a bug?  Shouldn't ShowAll do what these two commands do?
			// gladeWindow.glwidget.ShowAll();
			gladeWindow.glwidget.Show();
			gladeWindow.glw.Show();
			
			Application.Run ();

			return 0;
		}		
	}
}