Click here to Skip to main content
15,897,371 members
Articles / Multimedia / OpenGL

Creating a Window - Building a 3D Engine

Rate me:
Please Sign up or sign in to vote.
3.67/5 (4 votes)
7 Feb 2009CPOL4 min read 50.5K   2K   35  
This article describes the creation of an OpenGL window or OpenGL control with C# and Tao Framework
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AGE_Engine3D;

namespace Test01_Triangles
{
    public partial class TestForm : Form
    {
        private double TimerInterval = 16;

        private System.Timers.Timer RenderTimer = null;

        public BaseSimulation TheSimulation
        {
            set { this.openGLControl1.LoadSimulation(value); }
        }
        public TestForm()
        {
            InitializeComponent();
        }

        private void TestForm_Load(object sender, EventArgs e)
        {
            RenderTimer = new System.Timers.Timer(this.TimerInterval);
            RenderTimer.Elapsed += new System.Timers.ElapsedEventHandler(RenderTimer_Elapsed);
            RenderTimer.Start();
        }

        void RenderTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
                this.openGLControl1.Invalidate();
        }

        private void TestForm_Activated(object sender, EventArgs e)
        {
            this.openGLControl1.Activated();
        }

        private void TestForm_Deactivate(object sender, EventArgs e)
        {
            this.openGLControl1.Deactivate();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Lea+Elliott, Inc.
United States United States
I am a licensed Electrical Engineer at Lea+Elliott, Inc. We specialize in the planning, procurement and implementation of transportation systems, with special emphasis on automated and emerging technologies.

Comments and Discussions