override public void Desenhar(OpenGL Ecran_gl) { Ecran_gl.Enable(OpenGL.GL_LIGHTING); Ecran_gl.LineWidth(2.0f); Ecran_gl.PushMatrix(); Ecran_gl.Translate(TX, TY, TZ); Ecran_gl.Rotate(RX, RY, RZ); // Ecran_gl.Color(0.5f, 0.2f, 1.0f); Ecran_gl.Enable(OpenGL.GL_TEXTURE_2D); TexturaActiva.Bind(Ecran_gl); Ecran_gl.Begin(OpenGL.GL_QUADS); Ecran_gl.TexCoord(0.0f, 0.0f); Ecran_gl.Vertex(PC[0].GetX(), PC[0].GetY(), PC[0].GetZ()); Ecran_gl.TexCoord(1.0f, 0.0f); Ecran_gl.Vertex(PC[1].GetX(), PC[1].GetY(), PC[1].GetZ()); Ecran_gl.TexCoord(1.0f, 1.0f); Ecran_gl.Vertex(PC[2].GetX(), PC[2].GetY(), PC[2].GetZ()); Ecran_gl.TexCoord(0.0f, 1.0f); Ecran_gl.Vertex(PC[3].GetX(), PC[3].GetY(), PC[3].GetZ()); Ecran_gl.End(); Ecran_gl.Disable(OpenGL.GL_TEXTURE_2D); Ecran_gl.Color(1.0f, 0.0f, 1.0f); SharpGLForm.Linha(Ecran_gl, PC[0], PC[1]); SharpGLForm.Linha(Ecran_gl, PC[1], PC[2]); SharpGLForm.Linha(Ecran_gl, PC[2], PC[3]); SharpGLForm.Linha(Ecran_gl, PC[3], PC[0]); SharpGLForm.Linha(Ecran_gl, PC[4], PC[5]); SharpGLForm.Linha(Ecran_gl, PC[5], PC[6]); SharpGLForm.Linha(Ecran_gl, PC[6], PC[7]); SharpGLForm.Linha(Ecran_gl, PC[7], PC[4]); SharpGLForm.Linha(Ecran_gl, PC[0], PC[4]); SharpGLForm.Linha(Ecran_gl, PC[1], PC[5]); SharpGLForm.Linha(Ecran_gl, PC[2], PC[6]); SharpGLForm.Linha(Ecran_gl, PC[3], PC[7]); Ecran_gl.PopMatrix(); RX += incrx; RY += incry; RZ += incrz; Ecran_gl.Disable(OpenGL.GL_LIGHTING); }
public void Draw(OpenGL Ecran_gl) { Ecran_gl.LineWidth(2.0f); Ecran_gl.Color(1.0f, 0.0f, 0.0f); SharpGLForm.Linha(Ecran_gl, 0.0f, 0.0f, 0.0f, lenght, 0.0f, 0.0f); Ecran_gl.Color(0.0f, 1.0f, 0.0f); SharpGLForm.Linha(Ecran_gl, 0.0f, 0.0f, 0.0f, 0.0f, lenght, 0.0f); Ecran_gl.Color(0.0f, 0.0f, 1.0f); SharpGLForm.Linha(Ecran_gl, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, lenght); Ecran_gl.LineWidth(0.5f); Ecran_gl.Color(1.0f, 1.0f, 1.0f); // Desenhar a Base float Inc = lenght / 5.0f; float dy = 0.01f; for (float X = -lenght; X <= lenght; X += Inc) { SharpGLForm.Linha(Ecran_gl, X, dy, -lenght, X, dy, lenght); } ; for (float Z = -lenght; Z <= lenght; Z += Inc) { SharpGLForm.Linha(Ecran_gl, -lenght, dy, Z, lenght, dy, Z); } ; Ecran_gl.Enable(OpenGL.GL_TEXTURE_2D); TexturaXOZ.Bind(Ecran_gl); Ecran_gl.Begin(OpenGL.GL_QUADS); // Plano XOZ Ecran_gl.TexCoord(0.0f, 0.0f); Ecran_gl.Vertex(-lenght, 0, -lenght); Ecran_gl.TexCoord(1.0f, 0.0f); Ecran_gl.Vertex(-lenght, 0, lenght); Ecran_gl.TexCoord(1.0f, 1.0f); Ecran_gl.Vertex(lenght, 0, lenght); Ecran_gl.TexCoord(0.0f, 1.0f); Ecran_gl.Vertex(lenght, 0, -lenght); Ecran_gl.End(); TexturaXOY.Bind(Ecran_gl); Ecran_gl.Begin(OpenGL.GL_QUADS); // Plano XOY Ecran_gl.TexCoord(0.0f, 0.0f); Ecran_gl.Vertex(lenght, 0, -lenght); Ecran_gl.TexCoord(1.0f, 0.0f); Ecran_gl.Vertex(lenght, 2 * lenght, -lenght); Ecran_gl.TexCoord(1.0f, 1.0f); Ecran_gl.Vertex(-lenght, 2 * lenght, -lenght); Ecran_gl.TexCoord(0.0f, 1.0f); Ecran_gl.Vertex(-lenght, 0, -lenght); Ecran_gl.End(); TexturaZOY.Bind(Ecran_gl); Ecran_gl.Begin(OpenGL.GL_QUADS); // Plano ZOY Ecran_gl.TexCoord(0.0f, 0.0f); Ecran_gl.Vertex(-lenght, 0, -lenght); Ecran_gl.TexCoord(1.0f, 0.0f); Ecran_gl.Vertex(-lenght, 2 * lenght, -lenght); Ecran_gl.TexCoord(1.0f, 1.0f); Ecran_gl.Vertex(-lenght, 2 * lenght, lenght); Ecran_gl.TexCoord(0.0f, 1.0f); Ecran_gl.Vertex(-lenght, 0, lenght); Ecran_gl.End(); Ecran_gl.Disable(OpenGL.GL_TEXTURE_2D); }