コード例 #1
0
ファイル: Form1.cs プロジェクト: bizzehdee/glsharp
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            m_gl.Clear(GL.GL_FLAGS.COLOR_BUFFER_BIT | GL.GL_FLAGS.DEPTH_BUFFER_BIT);

            m_gl.Color3f(1.0F, 0, 0);
            m_gl.Begin(GL.GL_FLAGS.QUADS);

            m_gl.Normal3f(0.0F, 0.0F, 1.0F);

            m_gl.Vertex3f(0.5F, 0.5F, 0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, 0.5F);
            m_gl.Vertex3f(-0.5F, -0.5F, 0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, 0.5F);

            m_gl.Normal3f(0.0F, 0.0F, -1.0F);
            m_gl.Vertex3f(-0.5F, -0.5F, -0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, -0.5F);
            m_gl.Vertex3f(0.5F, 0.5F, -0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, -0.5F);

            m_gl.Normal3f(0.0F, 1.0F, 0.0F);
            m_gl.Vertex3f(0.5F, 0.5F, 0.5F);
            m_gl.Vertex3f(0.5F, 0.5F, -0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, -0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, 0.5F);

            m_gl.Normal3f(0.0F, -1.0F, 0.0F);
            m_gl.Vertex3f(-0.5F, -0.5F, -0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, -0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, 0.5F);
            m_gl.Vertex3f(-0.5F, -0.5F, 0.5F);

            m_gl.Normal3f(1.0F, 0.0F, 0.0F);
            m_gl.Vertex3f(0.5F, 0.5F, 0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, 0.5F);
            m_gl.Vertex3f(0.5F, -0.5F, -0.5F);
            m_gl.Vertex3f(0.5F, 0.5F, -0.5F);

            m_gl.Normal3f(-1.0F, 0.0F, 0.0F);
            m_gl.Vertex3f(-0.5F, -0.5F, -0.5F);
            m_gl.Vertex3f(-0.5F, -0.5F, 0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, 0.5F);
            m_gl.Vertex3f(-0.5F, 0.5F, -0.5F);

            m_gl.End();

            m_wgl.SwapBuffers(hdc);
        }