Updated T10_GLSL_Cube to explicitly create a render window.
Added input driver to W01_First_Window. Works perfectly! Added a debug message to GameWindow.cs, when accessing the opengl Context before creating a render window (this forces render window creation).
This commit is contained in:
parent
4ceea208ac
commit
c16968c06c
3 changed files with 10 additions and 0 deletions
|
@ -50,6 +50,7 @@ namespace Examples.Tutorial
|
|||
|
||||
public T10_GLSL_Cube()
|
||||
{
|
||||
this.CreateWindow(new OpenTK.Platform.DisplayMode(800, 600));
|
||||
Context.MakeCurrent();
|
||||
|
||||
//Text =
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Examples.WinForms
|
|||
{
|
||||
public partial class W01_First_Window : Form, IExample
|
||||
{
|
||||
OpenTK.InputDevices input;
|
||||
public W01_First_Window()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -30,6 +31,13 @@ namespace Examples.WinForms
|
|||
this.ShowDialog();
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
|
||||
input = new OpenTK.InputDevices(this.Handle);
|
||||
}
|
||||
|
||||
private void redButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
GL.ClearColor(0.7f, 0.0f, 0.0f, 0.0f);
|
||||
|
|
|
@ -175,6 +175,7 @@ namespace OpenTK
|
|||
{
|
||||
if (!glWindow.Created)
|
||||
{
|
||||
Debug.WriteLine("WARNING: OpenGL Context accessed before creating a render window. This may indicate a programming error. Force-creating a render window.");
|
||||
mode = new DisplayMode(640, 480);
|
||||
this.CreateWindow(mode);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue