
OpenTK Example
Posted Monday, 31 May, 2010 - 22:39 by adityatan inHi there,
I followed the very first example provided in the OpenTK manual. The data builds successfully; however as it runs, the glControl1 still come out white.
Below is the code. Please help. I'm pretty sure that I'm missing a setup step. Thanks.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Trial003
{
public partial class Form1 : Form
{
bool loaded = false;
public Form1()
{
InitializeComponent();
}
private void glControl1_Load(object sender, EventArgs e)
{
loaded = true;
GL.ClearColor(Color.SkyBlue);
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
if (!loaded)
return;
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
glControl1.SwapBuffers();
}
}
}


Comments
Re: OpenTK Example
Hi.
Errors from the past. :-) What OS and what version of OpenTK/OpenTK.GLControl you are using?
And, please:
Re: OpenTK Example
Hi there,
I used the latest OS and the latest version of OpenTK. I am using VS2008, by the way, in Windows 7 using Mac's Bootcamp.
Sorry, I don't get your last comment; I'm new :)
Thanks.
Re: OpenTK Example
Strange. Are you sure, do you have your glControl1_Paint connected to the paint event of glControl1? Please look three times. :-)
Sorry, I don't get your last comment; I'm new :)
Means:
if you copy your code and past it here, it looks so:
private void glControl1_Load(object sender, EventArgs e)
{
loaded = true;
GL.ClearColor(Color.SkyBlue);
}
then, mark this code and press the button of your programming language and it looks so:
Agreed that it is better to read?