public static void Texture(int x, int y, int width, int height, Texture tex) { GL.BindTexture(TextureTarget.Texture2D, tex.ID); GL.Begin(BeginMode.Quads); GL.TexCoord2(1.0, 0.0); GL.Vertex2(x + width, y); GL.TexCoord2(1.0, 1.0); GL.Vertex2(x + width, y + height); GL.TexCoord2(0.0, 1.0); GL.Vertex2(x, y + height); GL.TexCoord2(0.0, 0.0); GL.Vertex2(x, y); GL.End(); }
Game() : base(1280, 1024, new GraphicsMode(32, 24, 0, 0), "Blocky", GameWindowFlags.Fullscreen) { Instance = this; Camera = new Camera(){ Location = new Vector3d(0, -2, 36), Rotation = new Vector2(0, 20) }; Physics = new Physics(); Texture = new Texture("terrain.png"); Texture.SetMinFilter(TextureMinFilter.Nearest); Texture.SetMagFilter(TextureMagFilter.Nearest); new Props.Playground(32, Matrix4.CreateTranslation(0.0f, 0.0f, 0.0f)); for (int x = 1; x <= 7; x++) for (int y = 1; y <= 7; y++) for (int z = 1; z <= 7; z++) SpawnCube(1.0f, 1.0f, Matrix4.CreateTranslation(x*2-8.0f, y*2-1.0f, z*2-8.0f)); }
public static void Texture(int x, int y, Texture tex) { Texture(x, y, tex.Width, tex.Height, tex); }