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(); }
public virtual void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix) { Matrix4 worldMatrix = GetWorldMatrix(); texture.BindTexture(TextureUnit.Texture0); shader.startProgram(); shader.SetTransformatrionMatrices(worldMatrix, viewMatrix, projectionMatrix); shader.SetDiffuseTexture(0); shader.SetOpacity(0.2f); GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); VAOManager.renderBuffers(model.Buffer, OpenTK.Graphics.OpenGL.PrimitiveType.Triangles); GL.Disable(EnableCap.Blend); GL.Disable(EnableCap.CullFace); shader.stopProgram(); foreach (var item in ChildrenComponents) { SceneComponent comp = item as SceneComponent; if (comp != null) { comp.Render(viewMatrix, projectionMatrix); } } }
public void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix) { UpdateWorldMatrix(); shader.startProgram(); texture.BindTexture(OpenTK.Graphics.OpenGL.TextureUnit.Texture0); shader.SetDiffuseTexture(0); shader.SetTransformatrionMatrices(WorldMatrix, viewMatrix, projectionMatrix); shader.SetOpacity(1); VAOManager.renderBuffers(rawModel.Buffer, OpenTK.Graphics.OpenGL.PrimitiveType.Triangles); shader.stopProgram(); foreach (var item in ChildrenComponents) { SceneComponent comp = item as SceneComponent; if (comp != null) { comp.Render(viewMatrix, projectionMatrix); } } }
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(); }