//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RIApplication::RIApplication(int& argc, char** argv) : QApplication(argc, argv) { // USed to get registry settings in the right place QCoreApplication::setOrganizationName(RI_COMPANY_NAME); QCoreApplication::setApplicationName(RI_APPLICATION_NAME); // For idle processing // m_idleTimerStarted = false; installEventFilter(this); //cvf::Trace::enable(false); m_preferences = new RIPreferences; readPreferences(); applyPreferences(); if (useShaders()) { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::SHADER_BASED); } else { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION); } // Start with a project m_project = new RimProject; setWindowIcon(QIcon(":/AppLogo48x48.png")); m_socketServer = new RiaSocketServer( this); m_workerProcess = NULL; }
void Skybox::render(const glm::mat4 &view, const glm::mat4 &projection) { glDepthMask(GL_FALSE);// Remember to turn depth writing off useShaders(); _scene->setUniformVariables(_pid, _model, view, projection); // skybox cube glBindVertexArray(_VAO); glActiveTexture(GL_TEXTURE0); glUniform1i(glGetUniformLocation(_pid, "skybox"), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, _cubemapTextureId); glDrawArrays(GL_TRIANGLES, 0, 36); glBindVertexArray(0); glDepthMask(GL_TRUE); }
void Water::render(const glm::mat4 &view, const glm::mat4 &projection) { useShaders(); // Set uniform variables for the vertex and fragment glsl files _scene->setUniformVariables(_pid, _model, view, projection); // grid size uniform GLuint grid_size_id = glGetUniformLocation(_pid, "grid_size"); glm::float1 grid_size = (float)GRID_SIZE; glUniform1f(grid_size_id, grid_size); // water height uniform GLuint water_height_id = glGetUniformLocation(_pid, "water_height"); //Todo constante a FIXER glUniform1f(water_height_id, Constants::WATER_HEIGHT); //time uniform GLuint time_id = glGetUniformLocation(_pid, "time"); glm::float1 time_size = _scene->getReflectTime(); glUniform1f(time_id, time_size); /* Bind textures */ //Terrain reflection glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, _perlinTextureId); glUniform1i(glGetUniformLocation(_pid, "tex"), 0); //Terrain reflection glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, _mirrorTextureId); glUniform1i(glGetUniformLocation(_pid, "tex_mirror"), 1); // Draw glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindVertexArray(_vertexArrayId); glDrawElements(GL_TRIANGLE_STRIP, _indices.size(), GL_UNSIGNED_INT, 0); glBindVertexArray(0); glDisable(GL_BLEND); }