public void DrawTop(Texture texture = null) { foreach (Polygon p in this.polygonsTop) { p.Draw(texture); } }
public void DrawLabyrinth(Texture texture = null) { foreach (Polygon p in this.polygons) { p.Draw(texture); } }
public void DrawFloor(Texture texture = null) { foreach (Polygon p in this.polygonsFloor) { p.Draw(texture); } }
public void Draw(Texture Txtr = null) { float[][] textCoord = new float[4][]; if (Txtr != null) { for (int i = 0; i < 4; i++) { textCoord[i] = new float[3]; for (int j = 0; j < 3; j++) { textCoord[i][j] = 0.0f; } } textCoord[0][2] = 1.0f; textCoord[1][0] = 1.0f; textCoord[1][2] = 1.0f; textCoord[2][0] = 1.0f; GL.BindTexture(TextureTarget.Texture3D, Txtr.GetTexture); } GL.Color3(this.color); GL.Begin(BeginMode.Polygon); int count = 0; foreach (int[] coord in this.arrCoord) { if (Txtr != null) GL.TexCoord3(textCoord[count][0], textCoord[count][1], textCoord[count][2]); GL.Vertex3(coord[0], coord[1], coord[2]); //System.Console.Write("==> " + coord[0] + " " + coord[1] + " " + coord[2] + "\n"); count++; } GL.End(); }
private void MyPaint() { Bitmap bitmap = new Bitmap(@"img\wall.jpg"); Bitmap bitmapTop = new Bitmap(@"img\top.jpg"); Bitmap bitmapFloor = new Bitmap(@"img\pol.jpg"); if (Txtr == null) Txtr = new Texture(bitmap); if (TxtrTop == null) TxtrTop = new Texture(bitmapTop); if (TxtrFloor == null) TxtrFloor = new Texture(bitmapFloor); Mapper map = new Mapper(); Labyrinth lab = new Labyrinth(map.Polygons, map.PolygonsTop, map.PolygonsFloor); lab.DrawLabyrinth(Txtr); lab.DrawTop(TxtrTop); lab.DrawFloor(TxtrFloor); glControl1.SwapBuffers(); }