如何在 Vs 2008 中运行 OpenTk?
我尝试学习OpenTk(旧版Tao Framework),但我不能简单地画线:
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
using OpenTK.Input;
namespace Test1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
// COORDINATE SYSTEM ALGORITHM:
GL.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL.ShadeModel(ShadingModel.Flat);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
glControl1.SwapBuffers();
GL.Begin(BeginMode.Lines);
GL.Vertex2(0.0, -1.0);
GL.Vertex2(0.0, 1.0);
GL.Vertex2(1.0, 0.0);
GL.Vertex2(-1.0, 0.0);
GL.End();
}
}
}
我无法观看坐标系。我认为在 vs 2008 中不能运行 open tk 吗?你最好的建议是什么?
i try to learn OpenTk (Old Version Tao Framework) But i can not simple draw Line :
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
using OpenTK.Input;
namespace Test1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
// COORDINATE SYSTEM ALGORITHM:
GL.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL.ShadeModel(ShadingModel.Flat);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
glControl1.SwapBuffers();
GL.Begin(BeginMode.Lines);
GL.Vertex2(0.0, -1.0);
GL.Vertex2(0.0, 1.0);
GL.Vertex2(1.0, 0.0);
GL.Vertex2(-1.0, 0.0);
GL.End();
}
}
}
i can not watch coordinate system. i think that can not run open tk in vs 2008? what is your best advise?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几点:
Several things :
它将在VS2008中运行。
这里有一些很好的 OpenTK 起始代码,可引导您完成 Winform + GLControl 的正确设置和一些简单的渲染。 (应该足以让你理清Calvin指出的各种问题了。)
http:// /www.opentk.com/doc/chapter/2/glcontrol
It will run in VS2008.
There's some good OpenTK starting code here that walks you through proper setup of a Winform + GLControl and some simple rendering. (It should be enough to let you sort out the various issues Calvin pointed out.)
http://www.opentk.com/doc/chapter/2/glcontrol