void Render() { Gl.Clear(GlClearBufferMask.ColorBufferBit); Gl.Begin(GlPrimitiveType.Quads); Gl.ActiveTexture(GlTextureUnit.Texture0); Gl.BindTexture(GlTextureTarget.Texture2d, Texture); Gl.TexCoord2f(0, 0); Gl.Vertex2f(-1, -1); Gl.TexCoord2f(1, 0); Gl.Vertex2f(1, -1); Gl.TexCoord2f(1, 1); Gl.Vertex2f(1, 1); Gl.TexCoord2f(0, 1); Gl.Vertex2f(-1, 1); Gl.End(); }
void Render() { Gl.Rotated(1, Axis[0], Axis[1], Axis[2]); Gl.PushMatrix(); Gl.Translated(0, 0, -1.575); Gl.Scaled(1, 1, 1.3); Axis[0] += RandomDouble() / 4; Axis[1] += RandomDouble() / 4; Axis[2] += RandomDouble() / 4; NormalizeAxis(); Gl.Clear(GlClearBufferMask.ColorBufferBit | GlClearBufferMask.DepthBufferBit); Gl.Color3f(1, 1, 1); Gl.Begin(GlPrimitiveType.Triangles); for (int i = 0; i < TeapotPatches.GetLength(0); ++i) { double fu; for (double u = 0; u < 1; u = fu) { fu = u + DeltaUV; double[] ab = null; double[] bb = null; double fv; for (double v = 0; v < 1; v = fv) { fv = v + DeltaUV; double[] aa; if (ab == null) { aa = CalculateSurface(i, u, v); } else { aa = ab; } double[] ba; if (bb == null) { ba = CalculateSurface(i, fu, v); } else { ba = bb; } ab = CalculateSurface(i, u, fv); bb = CalculateSurface(i, fu, fv); Gl.Vertex3dv(aa); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); Gl.Vertex3dv(bb); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); aa[1] *= -1; ba[1] *= -1; ab[1] *= -1; bb[1] *= -1; Gl.Vertex3dv(aa); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); Gl.Vertex3dv(bb); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); if (i < RotateXPatches) { aa[0] *= -1; ba[0] *= -1; ab[0] *= -1; bb[0] *= -1; Gl.Vertex3dv(aa); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); Gl.Vertex3dv(bb); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); aa[1] *= -1; ba[1] *= -1; ab[1] *= -1; bb[1] *= -1; Gl.Vertex3dv(aa); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); Gl.Vertex3dv(bb); Gl.Vertex3dv(ab); Gl.Vertex3dv(ba); ab[0] *= -1; bb[0] *= -1; } else { ab[1] *= -1; bb[1] *= -1; } } } } Gl.End(); Gl.PopMatrix(); }
void Render() { Gl.Rotatef(1, Axis[0], Axis[1], Axis[2]); Axis[0] += RandomFloat() / 4; Axis[1] += RandomFloat() / 4; Axis[2] += RandomFloat() / 4; NormalizeAxis(); Gl.Clear(GlClearBufferMask.ColorBufferBit | GlClearBufferMask.DepthBufferBit); Gl.Begin(GlPrimitiveType.Triangles); Gl.Color3f(1, 0, 0); Gl.Vertex3f(1, 1, 1); Gl.Vertex3f(1, -1, 1); Gl.Vertex3f(-1, 1, 1); Gl.Vertex3f(-1, -1, 1); Gl.Vertex3f(1, -1, 1); Gl.Vertex3f(-1, 1, 1); Gl.Color3f(0, 1, 1); Gl.Vertex3f(1, 1, -1); Gl.Vertex3f(1, -1, -1); Gl.Vertex3f(-1, 1, -1); Gl.Vertex3f(-1, -1, -1); Gl.Vertex3f(1, -1, -1); Gl.Vertex3f(-1, 1, -1); Gl.Color3f(0, 1, 0); Gl.Vertex3f(1, 1, 1); Gl.Vertex3f(1, 1, -1); Gl.Vertex3f(1, -1, 1); Gl.Vertex3f(1, -1, -1); Gl.Vertex3f(1, 1, -1); Gl.Vertex3f(1, -1, 1); Gl.Color3f(1, 0, 1); Gl.Vertex3f(-1, 1, 1); Gl.Vertex3f(-1, 1, -1); Gl.Vertex3f(-1, -1, 1); Gl.Vertex3f(-1, -1, -1); Gl.Vertex3f(-1, 1, -1); Gl.Vertex3f(-1, -1, 1); Gl.Color3f(0, 0, 1); Gl.Vertex3f(1, 1, 1); Gl.Vertex3f(1, 1, -1); Gl.Vertex3f(-1, 1, 1); Gl.Vertex3f(-1, 1, -1); Gl.Vertex3f(1, 1, -1); Gl.Vertex3f(-1, 1, 1); Gl.Color3f(1, 1, 0); Gl.Vertex3f(1, -1, 1); Gl.Vertex3f(1, -1, -1); Gl.Vertex3f(-1, -1, 1); Gl.Vertex3f(-1, -1, -1); Gl.Vertex3f(1, -1, -1); Gl.Vertex3f(-1, -1, 1); Gl.End(); }
void Render() { if (UpdateColorsEverFrame) { ++ColorOffset; } Gl.Clear(GlClearBufferMask.ColorBufferBit); Gl.Begin(GlPrimitiveType.Triangles); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 0) % 8]); Gl.Vertex2f(1, 1); Gl.Color3fv(Colors[(ColorOffset + 1) % 8]); Gl.Vertex2f(0, 1); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 1) % 8]); Gl.Vertex2f(0, 1); Gl.Color3fv(Colors[(ColorOffset + 2) % 8]); Gl.Vertex2f(-1, 1); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 2) % 8]); Gl.Vertex2f(-1, 1); Gl.Color3fv(Colors[(ColorOffset + 3) % 8]); Gl.Vertex2f(-1, 0); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 3) % 8]); Gl.Vertex2f(-1, 0); Gl.Color3fv(Colors[(ColorOffset + 4) % 8]); Gl.Vertex2f(-1, -1); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 4) % 8]); Gl.Vertex2f(-1, -1); Gl.Color3fv(Colors[(ColorOffset + 5) % 8]); Gl.Vertex2f(0, -1); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 5) % 8]); Gl.Vertex2f(0, -1); Gl.Color3fv(Colors[(ColorOffset + 6) % 8]); Gl.Vertex2f(1, -1); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 6) % 8]); Gl.Vertex2f(1, -1); Gl.Color3fv(Colors[(ColorOffset + 7) % 8]); Gl.Vertex2f(1, 0); Gl.Color3f(0.5f, 0.5f, 0.5f); Gl.Vertex2f(0, 0); Gl.Color3fv(Colors[(ColorOffset + 7) % 8]); Gl.Vertex2f(1, 0); Gl.Color3fv(Colors[(ColorOffset + 0) % 8]); Gl.Vertex2f(1, 1); Gl.End(); }