void element_BeforeRendering(object sender, Objects.RenderEventArgs e) { mat4 projectionMatrix = camera.GetProjectionMat4(); mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; IMVP element = sender as IMVP; element.SetShaderProgram(mvp); }
void element_AfterRendering(object sender, Objects.RenderEventArgs e) { IMVP iMVP = sender as IMVP; iMVP.ResetShaderProgram(); var element = sender as FontElement; if (element.blend) { GL.Disable(GL.GL_BLEND); } GL.BindTexture(GL.GL_TEXTURE_2D, 0); }
void pyramidElement_BeforeRendering(object sender, Objects.RenderEventArgs e) { mat4 projectionMatrix = camera.GetProjectionMat4(); projectionMatrix = glm.translate(projectionMatrix, new vec3(translateX, translateY, translateZ));// mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; IMVP element = sender as IMVP; element.SetShaderProgram(mvp); }
void sphereElement_BeforeRendering(object sender, Objects.RenderEventArgs e) { mat4 projectionMatrix = camera.GetProjectionMat4(); //projectionMatrix = glm.translate(projectionMatrix, new vec3(translateX, translateY, translateZ));// mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); //mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; //IMVP element = sender as IMVP; //element.SetShaderProgram(mvp); this.sphereElement.SetMatrix(projectionMatrix, viewMatrix, modelMatrix); this.sphereElement.LightPosition = new vec3(translateX, translateY, translateZ); }
void pyramidElement_BeforeRendering(object sender, Objects.RenderEventArgs e) { rotation += 3.0f; mat4 modelMatrix = glm.rotate(rotation, new vec3(0, 1, 0)); const float distance = 0.7f; viewMatrix = glm.lookAt(new vec3(-distance, distance, -distance), new vec3(0, 0, 0), new vec3(0, -1, 0)); int[] viewport = new int[4]; GL.GetInteger(GetTarget.Viewport, viewport); projectionMatrix = glm.perspective(60.0f, (float)viewport[2] / (float)viewport[3], 0.01f, 100.0f); mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; IMVP element = sender as IMVP; element.SetShaderProgram(mvp); }
void axisElement2_BeforeRendering(object sender, Objects.RenderEventArgs e) { AxisElement2 element = sender as AxisElement2; mat4 projectionMatrix = camera.GetProjectionMat4(); projectionMatrix = glm.translate(projectionMatrix, new vec3(translateX, translateY, translateZ));// mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); ShaderProgram shaderProgram = element.shaderProgram; shaderProgram.Bind(); shaderProgram.SetUniformMatrix4(AxisElement2.strprojectionMatrix, projectionMatrix.to_array()); shaderProgram.SetUniformMatrix4(AxisElement2.strviewMatrix, viewMatrix.to_array()); shaderProgram.SetUniformMatrix4(AxisElement2.strmodelMatrix, modelMatrix.to_array()); }
void axisElement_AfterRendering(object sender, Objects.RenderEventArgs e) { IMVP element = sender as IMVP; element.ResetShaderProgram(); }
void element_AfterRendering(object sender, Objects.RenderEventArgs e) { element.shaderProgram.Unbind(); }
void axisElement2_AfterRendering(object sender, Objects.RenderEventArgs e) { AxisElement2 element = sender as AxisElement2; element.shaderProgram.Unbind(); }
void element_AfterRendering(object sender, Objects.RenderEventArgs e) { //IMVP element = sender as IMVP; //element.ResetShaderProgram(); }