public WaterRenderer(Loader loader, WaterShader shader, Matrix4 projectionMatrix, WaterFrameBuffer fbos) { this.shader = shader; this.fbos = fbos; handleDudv = loader.LoadTexture(FILENAME); handleNormalMap = loader.LoadTexture(NORMAL_FILENAME); shader.Start(); shader.ConnecttextureUnits(); shader.LoadProjectionMatrix(projectionMatrix); shader.Stop(); SetUpVAO(loader); }
private void PrepareRender(Camera camera, Light light) { shader.Start(); shader.LoadViewMatrix(camera); moveFactor += WAVE_SPEED * (CoreEngine.Delta / 1000); moveFactor %= 1; shader.LoadMoveFactor(moveFactor); shader.LoadLight(light); GL.BindVertexArray(quad.VaoHandle); GL.EnableVertexAttribArray(0); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, fbos.ReflectionTexture); GL.ActiveTexture(TextureUnit.Texture1); GL.BindTexture(TextureTarget.Texture2D, fbos.RefractionTexture); GL.ActiveTexture(TextureUnit.Texture2); GL.BindTexture(TextureTarget.Texture2D, handleDudv); GL.ActiveTexture(TextureUnit.Texture3); GL.BindTexture(TextureTarget.Texture2D, handleNormalMap); GL.ActiveTexture(TextureUnit.Texture4); GL.BindTexture(TextureTarget.Texture2D, fbos.RefractionDepthTexture); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); }