namespace Yontem2
{
public partial class Form1 : Form
{
private static int widthEkran = 300, heightEkran = 300;
static int panel;
public Form1()
{
InitializeComponent();
}
private void simpleOpenGlControl1_Paint(object sender, PaintEventArgs e)
{
// create an OpenGL window
Glut.glutInit();
Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
Glut.glutInitWindowSize(Width, Height);
Glut.glutInitWindowPosition(100, 100);
//glutInitWindowSize(800, 800);
Glut.glutCreateWindow("");
//panel = Glut.glutCreateWindow("");
//Glut.glutCreateSubWindow(panel, 10, 10, 300, 300);
// provide the Glut callbacks that are necessary for running this tutorial
Glut.glutIdleFunc(OnRenderFrame);
Glut.glutDisplayFunc(OnDisplay);
Glut.glutMainLoop();
simpleOpenGlControl1.Refresh();
}
public static void OnDisplay()
{
}
public static void OnRenderFrame()
{
// set up the OpenGL viewport and clear both the color and depth bits
Gl.Viewport(0, 0, widthEkran, heightEkran);
Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Glut.glutSwapBuffers();
}
}
}
1条答案
按热度按时间rqqzpn5f1#
错误:没有可用的设备或呈现上下文!enter image description here