public SkyBox(string directory, string ext = ".png") { Texture = new TextureCube(directory, ext); Vector3[] positions = new Vector3[] { new Vector3(1.0f, -1.0f, -1.0f), new Vector3(1.0f, -1.0f, 1.0f), new Vector3(-1.0f, -1.0f, 1.0f), new Vector3(-1.0f, -1.0f, -1.0f), new Vector3(1.0f, 1.0f, -1.0f), new Vector3(1.0f, 1.0f, 1.0f), new Vector3(-1.0f, 1.0f, 1.0f), new Vector3(-1.0f, 1.0f, -1.0f) }; uint[] elements = new uint[] { 0, 1, 2, 3, 4, 7, 6, 5, 0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 0, 3, 7 }; Vao = new VAO(positions); Vao.addElementArray(elements); Shader = Shaders.SkyboxShader(); }
public SkyBox(int textureId) { Texture = textureId; vao = GL.GenVertexArray(); GL.BindVertexArray(vao); verts = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, verts); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts_f.Length * sizeof(float)), verts_f, BufferUsageHint.StaticDraw); GL.EnableVertexAttribArray(0); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0); elements = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ElementArrayBuffer, elements); GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(elems_u.Length * sizeof(uint)), elems_u, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindVertexArray(0); Shader = Shaders.SkyboxShader(); }