1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tao.OpenGl;
using System.Threading;
using System.ComponentModel;
using System.Diagnostics;
namespace NeHeExamples
{
public class Lesson05 : GlRenderModule
{
#region Private Fields
private static float rtri;
private static float rquad;
#endregion
#region Constructor
public Lesson05()
{
}
#endregion Constructor
private void InitGL()
{
Gl.glShadeModel(Gl.GL_SMOOTH);
Gl.glClearColor(0, 0, 0, 0.5f);
Gl.glClearDepth(1);
Gl.glEnable(Gl.GL_DEPTH_TEST);
Gl.glDepthFunc(Gl.GL_LEQUAL);
Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
}
private void DrawGLScene()
{
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
Gl.glLoadIdentity();
Gl.glTranslatef(-1.5f, 0, -6);
Gl.glRotatef(rtri, 0, 1, 0);
Gl.glBegin(Gl.GL_TRIANGLES);
Gl.glColor3f(1, 0, 0);
Gl.glVertex3f(0, 1, 0);
Gl.glColor3f(0, 1, 0);
Gl.glVertex3f(-1, -1, 1);
Gl.glColor3f(0, 0, 1);
Gl.glVertex3f(1, -1, 1);
Gl.glColor3f(1, 0, 0);
Gl.glVertex3f(0, 1, 0);
Gl.glColor3f(0, 0, 1);
Gl.glVertex3f(1, -1, 1);
.... |
Partager