Пример #1
0
        public void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix)
        {
            if (bPostConstructor)
            {
                shader  = PoolProxy.GetResource <ObtainShaderPool, ShaderAllocationPolicy <SkyboxShader>, string, SkyboxShader>(String.Format("{0}{1},{0}{2}", ProjectFolders.ShadersPath, "skyboxVS.glsl", "skyboxFS.glsl"));
                model   = new RawModel(attribs);
                cubemap = ProxyTextureLoader.LoadCubemap(new string[] {
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "right.bmp",
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "left.bmp",
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "top.bmp",
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "bottom.bmp",
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "back.bmp",
                    ProjectFolders.SkyboxTexturesPath + "/Day/" + "front.bmp"
                });


                bPostConstructor = false;
            }

            shader.startProgram();
            cubemap.BindTexture(OpenTK.Graphics.OpenGL.TextureUnit.Texture0);
            shader.SetTransformationMatrices(Matrix4.Identity, viewMatrix, projectionMatrix);
            shader.SetCubemap(0);
            VAOManager.renderBuffers(model.Buffer, OpenTK.Graphics.OpenGL.PrimitiveType.Triangles);
            shader.stopProgram();
        }
Пример #2
0
        public void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix)
        {
            if (bPostConstructor)
            {
                model   = new RawModel(attribs);
                shader  = new SkyboxShader(Environment.CurrentDirectory + "/../../Shaders/skyboxVS.glsl", Environment.CurrentDirectory + "/../../Shaders/skyboxFS.glsl");
                cubemap = ProxyTextureLoader.LoadCubemap(new string[] {
                    Environment.CurrentDirectory + "/../../Textures/Right.bmp",
                    Environment.CurrentDirectory + "/../../Textures/Left.bmp",
                    Environment.CurrentDirectory + "/../../Textures/top.bmp",
                    Environment.CurrentDirectory + "/../../Textures/bottom.bmp",
                    Environment.CurrentDirectory + "/../../Textures/Back.bmp",
                    Environment.CurrentDirectory + "/../../Textures/Front.bmp"
                });
                bPostConstructor = false;
            }

            shader.startProgram();
            cubemap.BindTexture(OpenTK.Graphics.OpenGL.TextureUnit.Texture0);
            shader.SetTransformationMatrices(viewMatrix, projectionMatrix);
            shader.SetCubemap(0);
            VAOManager.renderBuffers(model.Buffer, OpenTK.Graphics.OpenGL.PrimitiveType.Triangles);
            shader.stopProgram();
        }