/* * re-program firmware: this entire function and all subroutines must run from RAM * (don't make this static!) */ __attribute__ ((section (".coderam"))) void flashFirmware(uint8_t* source, uint32_t size){ __disable_irq(); // Disable ALL interrupts. Can only be executed in Privileged modes. setLed(RED); eeprom_unlock(); if(size > (16+16+64+128)*1024){ eeprom_erase_sector(FLASH_Sector_6); toggleLed(); // inline } if(size > (16+16+64)*1024){ eeprom_erase_sector(FLASH_Sector_5); toggleLed(); } if(size > (16+16)*1024){ eeprom_erase_sector(FLASH_Sector_4); toggleLed(); } if(size > 16*1024){ eeprom_erase_sector(FLASH_Sector_3); toggleLed(); } eeprom_erase_sector(FLASH_Sector_2); toggleLed(); eeprom_write_block(ADDR_FLASH_SECTOR_2, source, size); eeprom_lock(); eeprom_wait(); NVIC_SystemReset(); // (static inline) } void programFlashTask(void* p){ int sector = flashSectorToWrite; uint32_t size = flashSizeToWrite; uint8_t* source = (uint8_t*)flashAddressToWrite; if(sector >= 0 && sector < MAX_USER_PATCHES && size <= 128*1024){ uint32_t addr = getFlashAddress(sector); eeprom_unlock(); int ret = eeprom_erase(addr); if(ret == 0) ret = eeprom_write_block(addr, source, size); eeprom_lock(); registry.init(); if(ret == 0){ // load and run program int pc = registry.getNumberOfPatches()-MAX_USER_PATCHES+sector; program.loadProgram(pc); // program.loadDynamicProgram(source, size); program.resetProgram(false); }else{ setErrorMessage(PROGRAM_ERROR, "Failed to write program to flash"); } }else if(sector == 0xff && size < MAX_SYSEX_FIRMWARE_SIZE){ flashFirmware(source, size); }else{ setErrorMessage(PROGRAM_ERROR, "Invalid flash program command"); } vTaskDelete(NULL); } void eraseFlashTask(void* p){ int sector = flashSectorToWrite; if(sector == 0xff){ for(int i=0; i<MAX_USER_PATCHES; ++i) eraseFlashProgram(i); settings.clearFlash(); }else if(sector >= 0 && sector < MAX_USER_PATCHES){ eraseFlashProgram(sector); }else{ setErrorMessage(PROGRAM_ERROR, "Invalid flash erase command"); } registry.init(); vTaskDelete(NULL); } // static int midiMessagesToSend = 0; // void sendMidiDataTask(void* p){ // switch(midiMessagesToSend){ // case SYSEX_PRESET_NAME_COMMAND: // midi.sendPatchNames(); // break; // // case 0: // // midi.sendDeviceInfo(); // // break; // // case SYSEX_PARAMETER_NAME_COMMAND: // // midi.sendPatchParameterNames(); // // break; // // case SYSEX_FIRMWARE_VERSION: // // midi.sendFirmwareVersion(); // // break; // // case SYSEX_DEVICE_ID: // // midi.sendDeviceId(); // // break; // // case SYSEX_DEVICE_STATS: // // midi.sendDeviceStats(); // // break; // // case SYSEX_PROGRAM_MESSAGE: // // midi.sendProgramMessage(); // // break; // // case SYSEX_PROGRAM_STATS: // // midi.sendProgramStats(); // // break; // // case PATCH_BUTTON: // // midi.sendCc(PATCH_BUTTON, isPushButtonPressed() ? 127 : 0); // // break; // // case LED: // // midi.sendCc(LED, getLed() == NONE ? 0 : getLed() == GREEN ? 42 : 84); // // break; // // case 127: // // midi.sendSettings(); // // break; // } // midiMessagesToSend = -1; // vTaskDelete(NULL); // } #ifdef BUTTON_PROGRAM_CHANGE #ifndef abs #define abs(x) ((x)>0?(x):-(x)) #endif /* abs */ void programChangeTask(void* p){ setLed(RED); int pc = settings.program_index; int bank = getAnalogValue(0)*5/4096; int prog = getAnalogValue(1)*8/4096+1; do{ float a = getAnalogValue(0)*5/4096.0 - 0.5/5; float b = getAnalogValue(1)*8/4096.0 - 0.5/8; // if(a - (int)a < 0.8) // deadband each segment: [0.8-1.0) if(a > 0 && abs(a - (int)a - 0.1) > 0.2) // deadband each segment: [0.9-1.1] bank = (int)a; if(b > 0 && abs(b-(int)b - 0.1) > 0.2) prog = (int)b+1; if(pc != bank*8+prog){ toggleLed(); pc = bank*8+prog; updateProgramIndex(pc); vTaskDelay(20); } }while(isPushButtonPressed() || pc < 1 || pc >= (int)registry.getNumberOfPatches()); setLed(RED); program.loadProgram(pc); program.resetProgram(false); for(;;); // wait for program manager to delete this task }
void InitApp(float width, float height) { vec2 min, max; //fill in the blank min.x = -width/2; min.y = -height/2; max.x = width/2; max.y = height/2; pApp = new App(); Screen* pScreen = new Screen(min.x, min.y, max.x, max.y); // create the screen so you can start using gl functions! //programs ProgramManager* pProgramManager = ProgramManager::GetProgramManager(); int programID = pProgramManager->CreateProgram("vertex2.vert", "fragment2.frag"); pProgramManager->AddProgram("program1", programID); //now add textures and programs to the App TextureManager* pTextureManager = TextureManager::GetTextureManager(); pTextureManager->AddTexture("images/picture.png"); //add objects vec2 quadDimensions = {512.0f, 512.0f}; GLuint indices[6] = {0, 1, 3, 3, 1, 2}; pScreen->SetMatrixUniform(); // set the projection matrix Quad* pQuad = new Quad(&quadDimensions, indices, 6, "images/picture.png", "program1"); pScreen->AddObject(pQuad); pApp->AddObject(pScreen); }
void programFlashTask(void* p){ int sector = flashSectorToWrite; uint32_t size = flashSizeToWrite; uint8_t* source = (uint8_t*)flashAddressToWrite; if(sector >= 0 && sector < MAX_USER_PATCHES && size <= 128*1024){ uint32_t addr = getFlashAddress(sector); eeprom_unlock(); int ret = eeprom_erase(addr); if(ret == 0) ret = eeprom_write_block(addr, source, size); eeprom_lock(); registry.init(); if(ret == 0){ // load and run program int pc = registry.getNumberOfPatches()-MAX_USER_PATCHES+sector; program.loadProgram(pc); // program.loadDynamicProgram(source, size); program.resetProgram(false); }else{ setErrorMessage(PROGRAM_ERROR, "Failed to write program to flash"); } }else if(sector == 0xff && size < MAX_SYSEX_FIRMWARE_SIZE){ flashFirmware(source, size); }else{ setErrorMessage(PROGRAM_ERROR, "Invalid flash program command"); } vTaskDelete(NULL); }
IntegratorFunction::IntegratorFunction(Domain* domain, Framework *framework, CLSSource::Function* function) : CallableFunction(domain, framework, function->parameters), m_program(NULL) { ProgramManager* man = framework->getPrograManager(); ProgramBuilder builder(m_framework->getComputeContext()); size_t return_values = 0; m_program = man->manage(builder.createTimeIntegratorProgram(&m_domain, function, &return_values)); for (int i = 0; i < return_values; ++i) { m_returnValues.push_back(framework->createData(*domain, "")); } }
int main( int argc, char* args[] ) { init(); SDL_RenderPresent(gRenderer); ProgramManager* manager = new ProgramManager(gRenderer); manager->loop(); delete manager; close(); return 0; }
/*! Initialize the scene, reserve shaders, compile and cache program \param[in] None. \return None */ void ObjLoader::InitModel() { ProgramManager* ProgramManagerObj = MapRenderHandler->RendererProgramManager(); Transform* TransformObj = MapRenderHandler->RendererTransform(); if (! ( program = ProgramManagerObj->Program( ( char * )"PolkaShader" ) ) ) { program = ProgramManagerObj->ProgramInit( ( char * )"PolkaShader" ); ProgramManagerObj->AddProgram( program ); } program->VertexShader = ShaderManager::ShaderInit( VERTEX_SHADER_PRG, GL_VERTEX_SHADER ); program->FragmentShader = ShaderManager::ShaderInit( FRAGMENT_SHADER_PRG, GL_FRAGMENT_SHADER ); ////////////////////////////////////////////////////// /////////// Vertex shader ////////////////////////// ////////////////////////////////////////////////////// CACHE *m = reserveCache( VERTEX_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->VertexShader, ( char * )m->buffer, 1 ) ) exit( 1 ); freeCache( m ); } /////////// Fragment shader ////////////////////////// m = reserveCache( FRAGMENT_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->FragmentShader, ( char * )m->buffer, 1 ) ) exit( 2 ); freeCache( m ); } if( !ProgramManagerObj->ProgramLink( program, 1 ) ) exit( 3 ); // Use Phong Shade Program glUseProgram( program->ProgramID ); char MaterialAmbient = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialAmbient"); char MaterialSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialSpecular"); char MaterialDiffuse = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialDiffuse"); char LightAmbient = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightAmbient"); char LightSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightSpecular"); char LightDiffuse = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightDiffuse"); char ShininessFactor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"ShininessFactor"); char LightPosition = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightPosition"); timer = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"Time"); toggleIndex = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"toggleDiscardBehaviour"); char Side = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"Side"); char DotSize = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"DotSize"); char ModelColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"ModelColor"); char DotColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"DotColor"); char BackSideModelColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"BackSideModelColor"); char BackSideDotColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"BackSideDotColor"); if (MaterialAmbient >= 0){ glUniform3f(MaterialAmbient, 0.04f, 0.04f, 0.04f); } if (MaterialSpecular >= 0){ glUniform3f(MaterialSpecular, 1.0, 0.5, 0.5); } glm::vec3 color = glm::vec3(1.0, 1.0, 1.0); if (MaterialDiffuse >= 0){ glUniform3f(MaterialDiffuse, color.r, color.g, color.b); } if (LightAmbient >= 0){ glUniform3f(LightAmbient, 1.0f, 1.0f, 1.0f); } if (LightSpecular >= 0){ glUniform3f(LightSpecular, 1.0, 1.0, 1.0); } if (LightDiffuse >= 0){ glUniform3f(LightDiffuse, 1.0f, 1.0f, 1.0f); } if (ShininessFactor >= 0){ glUniform1f(ShininessFactor, 40); } if (LightPosition >= 0){ glUniform3f(LightPosition, 0.0, 0.0, 10.0 ); } if ( toggleIndex >= 0 ){ glUniform1i(toggleIndex, (int)toggle); } if ( Side >= 0 ){ glUniform1f(Side, 0.30); } if ( DotSize >= 0 ){ glUniform1f(DotSize, 0.13); } if (ModelColor >= 0){ glUniform3f(ModelColor, 1.0, 1.0, 1.0 ); } if (DotColor >= 0){ glUniform3f(DotColor, 0.4, 0.5, 1.0 ); } if (BackSideModelColor >= 0){ glUniform3f(BackSideModelColor, 0.0, 1.0, 0.0 ); } if (BackSideDotColor >= 0){ glUniform3f(BackSideDotColor, 1.0, 1.0, 1.0 ); } MVP = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewProjectionMatrix" ); MV = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewMatrix" ); NormalMatrix = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"NormalMatrix"); return; }
/*! Initialize the scene, reserve shaders, compile and cache program \param[in] None. \return None */ void ObjLoader::InitModel() { ProgramManager* ProgramManagerObj = MapRenderHandler->RendererProgramManager(); Transform* TransformObj = MapRenderHandler->RendererTransform(); if (! ( program = ProgramManagerObj->Program( ( char * )"ADSShader" ) ) ) { program = ProgramManagerObj->ProgramInit( ( char * )"ADSShader" ); ProgramManagerObj->AddProgram( program ); } program->VertexShader = ShaderManager::ShaderInit( VERTEX_SHADER_PRG, GL_VERTEX_SHADER ); program->FragmentShader = ShaderManager::ShaderInit( FRAGMENT_SHADER_PRG, GL_FRAGMENT_SHADER ); ////////////////////////////////////////////////////// /////////// Vertex shader ////////////////////////// ////////////////////////////////////////////////////// CACHE *m = reserveCache( VERTEX_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->VertexShader, ( char * )m->buffer, 1 ) ) exit( 1 ); freeCache( m ); } /////////// Fragment shader ////////////////////////// m = reserveCache( FRAGMENT_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->FragmentShader, ( char * )m->buffer, 1 ) ) exit( 2 ); freeCache( m ); } if( !ProgramManagerObj->ProgramLink( program, 1 ) ) exit( 3 ); // Use Phong Shade Program glUseProgram( program->ProgramID ); char MaterialAmbient = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialAmbient"); char MaterialSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialSpecular"); char MaterialDiffuse = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialDiffuse"); char LightAmbient = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightAmbient"); char LightSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightSpecular"); char LightDiffuse = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightDiffuse"); char ShininessFactor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"ShininessFactor"); char LightPosition = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightPosition"); char ModelColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"ModelColor"); char DotColor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"DotColor"); char Side = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"Side"); if (MaterialAmbient >= 0){ glUniform3f(MaterialAmbient, 0.04f, 0.04f, 0.04f); } if (MaterialSpecular >= 0){ glUniform3f(MaterialSpecular, 1.0, 1.0, 1.0); } glm::vec3 color = glm::vec3(1.0, 1.0, 0.0); if (MaterialDiffuse >= 0){ glUniform3f(MaterialDiffuse, color.r, color.g, color.b); } if (LightAmbient >= 0){ glUniform3f(LightAmbient, 1.0f, 1.0f, 1.0f); } if (LightSpecular >= 0){ glUniform3f(LightSpecular, 1.0, 1.0, 1.0); } if (LightDiffuse >= 0){ glUniform3f(LightDiffuse, 1.0f, 1.0f, 1.0f); } if (ShininessFactor >= 0){ glUniform1f(ShininessFactor, 40); } if ( LightPosition >= 0 ){ glm::vec3 lightPosition(0.0, 5.0, 10); glUniform3fv(LightPosition, 1, (float*)&lightPosition); } if ( ModelColor >= 0 ){ glm::vec3 mColor(0.50, 0.50, 1.0); glUniform3fv(ModelColor, 1, (float*)&mColor); } if ( DotColor >= 0 ){ glm::vec3 dColor(1.0, 1.0, 10); glUniform3fv(DotColor, 1, (float*)&dColor); } if ( Side >= 0 ){ glUniform1f(Side, 80); } MVP = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewProjectionMatrix" ); MV = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewMatrix" ); NormalMatrix = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"NormalMatrix"); return; }
void RenderDevice::render( const RenderState& state, const LightQueue& lights ) { BufferManager* buffers = activeContext->bufferManager; ProgramManager* programs = activeContext->programManager; RenderBatch* renderable = state.renderable; bindBuffers(renderable); const GeometryBuffer* gb = renderable->getGeometryBuffer().get(); if( gb->data.Empty() ) return; BufferEntry* bufs = buffers->getBuffer(gb); // Setup the vertex buffer format. VertexBuffer* vb = bufs->vb.get(); renderBackend->setupVertexBuffer(vb); Material* material = state.material; ShaderMaterial* shader = material->getShader().Resolve(); ShaderProgram* shaderProgram = programs->getProgram(shader); if( !shaderProgram ) return; if( !shaderProgram->isLinked() && !shaderProgram->link() ) return; shaderProgram->bind(); renderBackend->setupRenderState(state, true); bindTextureUnits(state, true); if( !renderable->onPreRender.empty() ) { // Call the user pre render hook. renderable->onPreRender(activeView, state); } RenderLayer stage = renderable->getRenderLayer(); if( stage != RenderLayer::Overlays ) { if( !setupRenderStateMatrix(state) ) return; //if( !setupRenderStateLight(state, lights) ) // return; } else if( stage == RenderLayer::Overlays ) { if( !setupRenderStateOverlay(state) ) return; } UniformBuffer* ub = renderable->getUniformBuffer().get(); shaderProgram->setUniforms(ub); renderBackend->renderBatch(renderable); if( !renderable->onPostRender.empty() ) { // Call the user post render hook. renderable->onPostRender(activeView, state); } renderBackend->unsetupRenderState(state); unbindTextureUnits(state.material); shaderProgram->unbind(); renderBackend->unbindVertexBuffer(vb); unbindBuffers(renderable); }
VOID Player::turn(ProgramManager &rProgramManager, GameInfo &rGameInfo) { if(rGameInfo.first == first_) { if(rGameInfo.scoredEight) rProgramManager.endGame(name_ + L" выиграл со счЄтом: " + getScoreWStr()); else if(rGameInfo.scoredZero) { rGameInfo.scoredZero = FALSE; rGameInfo.drawCue = FALSE; rGameInfo.turn = Turns::SetZeroPos; rProgramManager.updateZero(); } else if(rGameInfo.scoredWrong) { rGameInfo.scoredWrong = FALSE; rGameInfo.drawCue = FALSE; rGameInfo.turn = Turns::SetPos; } if(!copied_) { memcpy(tmpBallsStatus_, rProgramManager.getScored(), sizeof(tmpBallsStatus_)); memcpy(tmpBallsPos_, rProgramManager.getPoints(), sizeof(tmpBallsPos_)); copied_ = !copied_; } if(rGameInfo.turn == Turns::SetZeroPos) { rProgramManager.setBallCoords(rProgramManager.getMousePos()); rProgramManager.work(textToDraw(), PointF(0, 0), static_cast<ARGB>(Color::LightGreen), FALSE); if(Key(VK_END)) { rGameInfo.turn = Turns::Blow; rGameInfo.drawCue = TRUE; } } else if(rGameInfo.turn == Turns::SetPos) { rProgramManager.setBallCoords(rProgramManager.getMousePos(), rGameInfo.wrongBall); rProgramManager.work(textToDraw(), PointF(0, 0), static_cast<ARGB>(Color::LightGreen), FALSE); if(Key(VK_END)) { rGameInfo.turn = Turns::Blow; rGameInfo.drawCue = TRUE; } } else if(rGameInfo.turn == Turns::Blow) { if(Key(VK_SPACE)) { POINT cursor = { 0, 0 }; GetCursorPos(&cursor); rProgramManager.nextMove(); rGameInfo.turn = Turns::Step; } else rProgramManager.work(textToDraw()); } else if(rGameInfo.turn == Turns::Step) { if(!rProgramManager.stopBalls()) rProgramManager.work(textToDraw()); else { updateScore(checkScored(rProgramManager, rGameInfo)); if(!checkPoints(rProgramManager)) if(score_ != 0) score_--; resetValues(); rGameInfo.resetToNext(); } } } else rProgramManager.work(textToDraw(), PointF(static_cast<REAL>(rProgramManager.getMemDCWindow().width - 6 * sizestenaRIGHT), 0), static_cast<ARGB>(Color::Red), rGameInfo.drawCue); }
WORD Player::checkScored(ProgramManager &rProgramManager, GameInfo &rGameInfo) { WORD ret_val = 0; for(size_t i = 0; i < NUMBER_OF_BALLS; i++) if(tmpBallsStatus_[i] != rProgramManager.getScored()[i]) { BallType ballType = getBallType(static_cast<Balls::Ball>(i)); if(!rGameInfo.firstScore && ballType != BallType::Zero) { rGameInfo.firstScore = !rGameInfo.firstScore; ballType_ = ballType; rGameInfo.ballType2 = (ballType_ == BallType::Solid)? BallType::Striped : BallType::Solid; } else if(ballType_ == BallType::NoType && rGameInfo.firstScore) ballType_ = rGameInfo.ballType2; switch(ballType) { case BallType::Zero: rProgramManager.updateZero(); rGameInfo.scoredZero = TRUE; if(score_ != 0) score_--; break; case BallType::Solid: if(i == Balls::Ball::eighth) { rGameInfo.scoredEight = TRUE; score_ = 0; return FALSE; } else { if(ballType_ == BallType::Solid) { rGameInfo.scored = TRUE; ret_val++; } else { rGameInfo.scoredWrong = TRUE; rGameInfo.wrongBall = static_cast<Balls::Ball>(i); if(score_ != 0) score_--; } } break; case BallType::Striped: if(ballType_ == BallType::Striped) ret_val++; else { rGameInfo.scoredWrong = TRUE; rGameInfo.wrongBall = static_cast<Balls::Ball>(i); if(score_ != 0) score_--; } break; default: PostQuitMessage(-999); } } return ret_val; }
void runManagerTask(void* p){ setup(); // call main OWL setup program.runManager(); }
PatchDefinition* getPatchDefinition(){ return program.getPatchDefinition(); }
/*! Initialize the scene, reserve shaders, compile and cache program \param[in] None. \return None */ void ObjLoader::InitModel() { ProgramManager* ProgramManagerObj = MapRenderHandler->RendererProgramManager(); Transform* TransformObj = MapRenderHandler->RendererTransform(); if (! ( program = ProgramManagerObj->Program( ( char * )"SpecularShader" ) ) ) { program = ProgramManagerObj->ProgramInit( ( char * )"SpecularShader" ); ProgramManagerObj->AddProgram( program ); } program->VertexShader = ShaderManager::ShaderInit( VERTEX_SHADER_PRG, GL_VERTEX_SHADER ); program->FragmentShader = ShaderManager::ShaderInit( FRAGMENT_SHADER_PRG, GL_FRAGMENT_SHADER ); /////////// Vertex shader ////////////////////////// CACHE *m = reserveCache( VERTEX_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->VertexShader, ( char * )m->buffer, 1 ) ) exit( 1 ); freeCache( m ); } /////////// Fragment shader ////////////////////////// m = reserveCache( FRAGMENT_SHADER_PRG, true ); if( m ) { if( !ShaderManager::ShaderCompile( program->FragmentShader, ( char * )m->buffer, 1 ) ) exit( 2 ); freeCache( m ); } if( !ProgramManagerObj->ProgramLink( program, 1 ) ) exit( 3 ); glUseProgram( program->ProgramID ); char MaterialSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"MaterialSpecular"); char LightSpecular = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightSpecular"); char ShininessFactor = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"ShininessFactor"); char LightPosition = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"LightPosition"); if (MaterialSpecular >= 0){ glUniform3f(MaterialSpecular, 1.0, 0.5, 0.5); } if (LightSpecular >= 0){ glUniform3f(LightSpecular, 1.0, 1.0, 1.0); } if (ShininessFactor >= 0){ glUniform1f(ShininessFactor, 40); } if (LightPosition >= 0){ glm::vec3 lightPosition(0.0, 0.0, 10.0); glUniform3fv(LightPosition, 1, (float*)&lightPosition); } MVP = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewProjectionMatrix" ); MV = ProgramManagerObj->ProgramGetUniformLocation( program, ( char* )"ModelViewMatrix" ); NormalMatrix = ProgramManagerObj->ProgramGetUniformLocation(program, (char*)"NormalMatrix"); return; }