如何使用sharpgl(C#)绘制点。 [英] How to draw points using sharpgl (C#).

查看:860
本文介绍了如何使用sharpgl(C#)绘制点。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用sharpgl绘制点但是当代码编译时它只给出了没有输出的白色控制台为什么会发生这种情况以及提前解决这个问题的解决方案。



I am trying to draw points using sharpgl but when the code is compiled it gives only white console with no output why is this happening and what is the solution of this thanks in advance.

private static int width = 400, height = 300;
        static void Main(string[] args)
        {

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Tutorial");
            init();
            Glut.glutDisplayFunc(OnDisplay);
            Glut.glutMainLoop();
        }

        private static void OnDisplay()
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glLoadIdentity();
            Gl.glTranslatef(0.0f, 0.0f, -4.0f);
            Gl.glColor3f(0.0f, 0.0f, 1.0f);
            Gl.glPointSize(10.0f);
            Gl.glBegin(Gl.GL_POINTS);
            Gl.glVertex3f(1.0f, 1.0f, 0.0f);
            Gl.glVertex3f(-1.0f, -1.0f, 0.0f);
            Gl.glEnd();
        }
        static void init()
        {

            Gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
        }

推荐答案

尝试

http://sharpgl.codeplex.com/discussions/436011 [ ^ ]

SharpGL:AC#OpenGL类库 [ ^ ]


这篇关于如何使用sharpgl(C#)绘制点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆