//Renders to Texture private void RenderToTexture_Bottom_Portal() { //Bind Bottom_Portal.Bind_Buffer(); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Portal_ViewportUpdate(); GL.Enable(EnableCap.CullFace); int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView"); Matrix4 previousView = mView; mView = mTopPortalView; GL.UniformMatrix4(uView, true, ref mView); camera.UpdateLightPositions(); Material.silver.Assign_Material(); BrickWall.MakeActive(); //Draws Cubes GL.BindVertexArray(mVAO[1]); DrawTopBox(mBoxMatrix * mGroundModel * Level.Level0); DrawBox(mBoxMatrix * mGroundModel * Level.Level1); DrawBox(mBoxMatrix * mGroundModel * Level.Level2); DrawBottomBox(mBoxMatrix * mGroundModel * Level.Level3); //Draws the Spheres GL.BindVertexArray(mVAO[0]); foreach (Sphere s in Sphere.DrawList) { s.Draw(); } //This stops the back of cylinders from not being drawn GL.Disable(EnableCap.CullFace); //Draws Cylinders GL.BindVertexArray(mVAO[2]); foreach (Cylinder c in Level.Level1_Cylinders) //LEVEL 1 { Level.Draw_Cylinders(c, Level.Level1); } mView = previousView; GL.UniformMatrix4(uView, true, ref mView); //Unbind Frame_Buffer.Unbind_Buffer(); }
private void RenderToTexture_Top_Portal() { //Bind Top_Portal.Bind_Buffer(); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Portal_ViewportUpdate(); GL.Enable(EnableCap.CullFace); int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView"); Matrix4 previousView = mView; mView = mBottomPortalView; GL.UniformMatrix4(uView, true, ref mView); camera.UpdateLightPositions(); //Draws the Spheres GL.BindVertexArray(mVAO[0]); foreach (Sphere s in Sphere.DrawList) { s.Draw(); } GL.BindVertexArray(mVAO[1]); DrawTopBox(mBoxMatrix * mGroundModel * Level.Level0); DrawBox(mBoxMatrix * mGroundModel * Level.Level1); DrawBox(mBoxMatrix * mGroundModel * Level.Level2); DrawBottomBox(mBoxMatrix * mGroundModel * Level.Level3); //SoD GL.BindVertexArray(mVAO[0]); Level.DoomSphere.Apply_MaterialValues(); Matrix4 DoomSphereLocation = Matrix4.CreateScale(Level.DoomSphere.mRadius) * Matrix4.CreateTranslation(Level.DoomSphere.mPosition) * Level.Level3 * mGroundModel; GL.UniformMatrix4(uModelLocation, true, ref DoomSphereLocation); GL.DrawElements(BeginMode.Triangles, mSphereModel.Indices.Length, DrawElementsType.UnsignedInt, 0); mView = previousView; GL.UniformMatrix4(uView, true, ref mView); //Unbind Frame_Buffer.Unbind_Buffer(); }