예제 #1
0
        internal void Load()
        {
            this.debugShader = Shader.CompileFromResource(
                "BlocksWorld.Shaders.Object.vs",
                "BlocksWorld.Shaders.Debug.fs");

            this.buffer = GL.GenBuffer();
            this.vao    = GL.GenVertexArray();

            GL.BindVertexArray(this.vao);
            {
                GL.BindBuffer(BufferTarget.ArrayBuffer, this.buffer);

                GL.EnableVertexAttribArray(0);
                GL.VertexAttribPointer(
                    0,
                    3,
                    VertexAttribPointerType.Float,
                    false,
                    Vector3.SizeInBytes,
                    0);
            }
            GL.BindVertexArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
        }
예제 #2
0
        protected override void OnLoad()
        {
            this.objectShader = Shader.CompileFromResource(
                "BlocksWorld.Shaders.Object.vs",
                "BlocksWorld.Shaders.Object.fs");

            this.textures = TextureArray.LoadFromResource(
                "BlocksWorld.Textures.Models.png");

            this.debug.Load();
        }
예제 #3
0
        public void Load()
        {
            this.shader = Shader.CompileFromResource(
                "BlocksWorld.Shaders.ScreenSpace.vs",
                "BlocksWorld.Shaders.Texture.fs");

            this.vao          = GL.GenVertexArray();
            this.vertexBuffer = GL.GenBuffer();
            this.texture      = GL.GenTexture();

            GL.BindVertexArray(this.vao);
            {
                GL.BindBuffer(BufferTarget.ArrayBuffer, this.vertexBuffer);

                GL.EnableVertexAttribArray(0);
                GL.VertexAttribPointer(
                    0,
                    2,
                    VertexAttribPointerType.Float,
                    false,
                    0,
                    Vector2.SizeInBytes);
            }
            GL.BindVertexArray(0);

            GL.BindBuffer(BufferTarget.ArrayBuffer, this.vertexBuffer);
            {
                GL.BufferData(
                    BufferTarget.ArrayBuffer,
                    new IntPtr(Vector2.SizeInBytes * vertices.Length),
                    vertices,
                    BufferUsageHint.StaticDraw);
            }
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

            GL.BindTexture(TextureTarget.Texture2D, this.texture);
            {
                GL.TexImage2D(
                    TextureTarget.Texture2D,
                    0,
                    PixelInternalFormat.Rgba,
                    this.backbuffer.Width, this.backbuffer.Height,
                    0,
                    PixelFormat.Bgra,
                    PixelType.UnsignedByte,
                    IntPtr.Zero);
                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            }
            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
예제 #4
0
        protected override void OnLoad()
        {
            this.objectShader = Shader.CompileFromResource(
                "BlocksWorld.Shaders.Object.vs",
                "BlocksWorld.Shaders.Object.fs");

            this.blockTextures = TextureArray.LoadFromResource(
                "BlocksWorld.Textures.Blocks.png");
            this.modelTextures = TextureArray.LoadFromResource(
                "BlocksWorld.Textures.Models.png");

            this.playerModel = MeshModel.LoadFromResource(
                "BlocksWorld.Models.Player.bwm");

            this.debug.Load();
            this.worldRenderer.Load();
            this.ui.Load();
        }