
Getting started, no visuals
Posted Sunday, 13 November, 2011 - 19:49 by gooberking inI've been playing around with OpenTK for a few days to see about remaking a program I made awhile back. The Quick starter works perfectly fine under both windows and linux. However, when I try and set things up for myself I start getting into trouble. I've had the same issue on both windows and linux, when I try and create a context by making a new Native Window, and when I use the GLWidget(which I will ultimately be using, and do have working) so I think I am not doing something.
The issue is that once the context is created I can set the clear color and swap buffers to see that color, but I can't draw anything. I have used old code of mine, as well as the sample draw code for the quickstart and all I see is an empty window with my chosen draw color.
at current the basic code is
protected virtual void OnGlwidget1Initialized (object sender, System.EventArgs e) { GL.ClearColor(1.0f,1.0f,0.5f,1.0f); } protected virtual void OnGlwidget1RenderFrame (object sender, System.EventArgs e) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref modelview); GL.Begin(BeginMode.Triangles); GL.Color3(1.0f, 1.0f, 0.0f); GL.Vertex3(-1.0f, -1.0f, 4.0f); GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.0f, -1.0f, 4.0f); GL.Color3(0.2f, 0.9f, 1.0f); GL.Vertex3(0.0f, 1.0f, 4.0f); GL.End(); OpenTK.Graphics.GraphicsContext.CurrentContext.SwapBuffers(); }
The context itself is currently being created by the GLWidget.

