void DrawCompass(OpenGL GL) { mat4 model = mat4.identity(); model = glm.translate(model, new vec3(7, -3, -6)); //model = glm.scale(model,new vec3(0.2f)); textureShader.Bind(GL); textureShader.SetUniform(GL, "projectionMatrix", glm.perspective(myGLM.D2R(60), (float)cWidth / (float)cHeight, 0.01f, 100.0f)); textureShader.SetUniform(GL, "viewMatrix", mat4.identity()); // glm.lookAt(new vec3(0f, 0f, -6f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f)) textureShader.SetUniform(GL, "modelMatrix", model); textureShader.SetUniform(GL, "normalMatrix", myGLM.transpose(glm.inverse(model))); //textureShader.SetUniform(GL, "sunLight.vColor", new vec3(1f, 1f, 1f)); //textureShader.SetUniform(GL, "sunLight.Ka", new vec3(.1f, .1f, .1f)); //textureShader.SetUniform(GL, "sunLight.Kd", new vec3(1f, 1f, 1f)); //textureShader.SetUniform(GL, "sunLight.vDirection", new vec3(0f, 0f, 1f)); //textureShader.SetUniform(GL, "specLight.vDirection", new vec3(0f, 0f, 0f)); //textureShader.SetUniform(GL, "specLight.Ks", new vec3(.9f, .9f, .9f)); //textureShader.SetUniform(GL, "specLight.Shininess", 100f); _compass.Render(GL, textureShader); //model = mat4.identity(); //model = glm.translate(model, new vec3(7, -3, -6)); //model = glm.rotate(model, D2R(-1 * _compassRot), new vec3(0f, 0f, 1f)); //model = glm.scale(model, new vec3(.1f, .8f, 1f)); //textureShader.SetUniform(GL, "projectionMatrix", glm.perspective(D2R(60), (float)cWidth / (float)cHeight, 0.01f, 100.0f)); //textureShader.SetUniform(GL, "viewMatrix", mat4.identity()); // glm.lookAt(new vec3(0f, 0f, -6f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f)) //textureShader.SetUniform(GL, "modelMatrix", model); //textureShader.SetUniform(GL, "normalMatrix", myGLM.transpose(glm.inverse(model))); //_cArrow.Render(GL, textureShader); textureShader.Unbind(GL); }
public void Render(OpenGL GL, GShaderProgram shader) { compassVAO.Bind(GL); TexContainer tc; tc = TextureManager.Instance.GetElement(_textureName); tc.Tex.Bind(GL); // Bind to the current texture on texture unit 0 GL.ActiveTexture(OpenGL.GL_TEXTURE0 + (uint)tc.ID); shader.SetUniform(GL, "uSampler", tc.ID); // Turn ON aplha blending for the arrow so the empty background is ignored GL.Enable(OpenGL.GL_BLEND); GL.BlendFunc(OpenGL.GL_SRC_ALPHA, OpenGL.GL_ONE_MINUS_SRC_ALPHA); GL.DrawArrays(OpenGL.GL_TRIANGLE_FAN, 0, _numSegments); GL.Disable(OpenGL.GL_BLEND); compassVAO.Unbind(GL); }