WINDOW display_image(IMAGE *image, const char *title, INT32 x, INT32 y, BOOL8 wait) { WINDOW im_window; INT16 i; GRAPHICS_EVENT event; //output event // xmin xmax ymin ymax im_window = create_window (title, SCROLLINGWIN, x, y, 10 * image->get_xsize (), 10 * image->get_ysize (), 0, image->get_xsize (), 0, image->get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(im_window); show_sub_image (image, 0, 0, image->get_xsize (), image->get_ysize (), im_window, 0, 0); line_color_index(im_window, RED); for (i = 1; i < image->get_xsize (); i++) { move2d (im_window, i, 0); draw2d (im_window, i, image->get_ysize ()); } for (i = 1; i < image->get_ysize (); i++) { move2d (im_window, 0, i); draw2d (im_window, image->get_xsize (), i); } overlap_picture_ops(TRUE); if (wait) await_event(im_window, TRUE, ANY_EVENT, &event); return im_window; }
void display_images(IMAGE &clip_image, IMAGE &scaled_image) { WINDOW clip_im_window; //window for debug WINDOW scale_im_window; //window for debug INT16 i; GRAPHICS_EVENT event; // c; // xmin xmax ymin ymax clip_im_window = create_window ("Clipped Blob", SCROLLINGWIN, editor_word_xpos - 20, editor_word_ypos - 100, 5 * clip_image.get_xsize (), 5 * clip_image.get_ysize (), 0, clip_image.get_xsize (), 0, clip_image.get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(clip_im_window); show_sub_image (&clip_image, 0, 0, clip_image.get_xsize (), clip_image.get_ysize (), clip_im_window, 0, 0); line_color_index(clip_im_window, RED); for (i = 1; i < clip_image.get_xsize (); i++) { move2d (clip_im_window, i, 0); draw2d (clip_im_window, i, clip_image.get_xsize ()); } for (i = 1; i < clip_image.get_ysize (); i++) { move2d (clip_im_window, 0, i); draw2d (clip_im_window, clip_image.get_xsize (), i); } // xmin xmax ymin ymax scale_im_window = create_window ("Scaled Blob", SCROLLINGWIN, editor_word_xpos + 300, editor_word_ypos - 100, 5 * scaled_image.get_xsize (), 5 * scaled_image.get_ysize (), 0, scaled_image.get_xsize (), 0, scaled_image.get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(scale_im_window); show_sub_image (&scaled_image, 0, 0, scaled_image.get_xsize (), scaled_image.get_ysize (), scale_im_window, 0, 0); line_color_index(scale_im_window, RED); for (i = 1; i < scaled_image.get_xsize (); i++) { move2d (scale_im_window, i, 0); draw2d (scale_im_window, i, scaled_image.get_xsize ()); } for (i = 1; i < scaled_image.get_ysize (); i++) { move2d (scale_im_window, 0, i); draw2d (scale_im_window, scaled_image.get_xsize (), i); } overlap_picture_ops(TRUE); await_event(scale_im_window, TRUE, ANY_EVENT, &event); destroy_window(clip_im_window); destroy_window(scale_im_window); }
static inline void display(void) { glViewport(0, 0, (GLsizei)img_width, (GLsizei)img_height); #if 0 glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, 1, 0, 1); #endif glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glShadeModel(GL_FLAT); // Display LIC image using texture mapping glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img_width, img_height, 0, GL_RGB, GL_UNSIGNED_BYTE, &(glTex_img[0])); glBegin(GL_QUAD_STRIP); glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex2f(0.0, 1.0); glTexCoord2f(1.0, 0.0); glVertex2f(1.0, 0.0); glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0); glEnd(); glDisable(GL_TEXTURE_2D); void draw2d(); draw2d(); glutSwapBuffers(); glFlush(); }
/* Metodo invocado quando trocamos de separador */ void MainWindow::on_tabSet_currentChanged( int index ) { Compass::Direction dir; switch( index ) { case MainWindow::TAB_FP2D_INDEX: draw2d(); assert( current_player >= 0 && current_player < MAX_PLAYERS && current_player < num_players ); // Verificacoes basicas dir = players[current_player].compass.getDirection(); break; case MainWindow::TAB_FP3D_INDEX: draw3d(); assert( current_player >= 0 && current_player < MAX_PLAYERS && current_player < num_players ); // Verificacoes basicas dir = players[current_player].compass.getDirection(); break; default: // MainWindow::TAB_MAP_INDEX e MainWindow::TAB_ABOUT_INDEX assert( num_players >= 0 ); // Verificacao basica dir = Compass::NORTH; break; } ui->dialCompass->setValue( dir ); }
/* Este metodo e' chamado quando o utilizador carrega em "OK" apos escolher o tamanho do labirinto, e apos ter sido chamado resetStateNew(). Ele inicia o processo de desenhar um novo labirinto. Restricoes (verificadas no assert(), abaixo): width >= 3 e impar height >= 3 e impar 0 < complexity <= 100 */ void MainWindow::buildMaze( int width, int height, int complexity ) { Map *map_old; int p, num; // Verificacoes basicas assert( ui != NULL && width >= 3 && (width & 1) == 1 && height >= 3 && (height & 1) == 1 && complexity > 0 && complexity <= 100 ); // Feedback visual de "a trabalhar" ui->pushNew->setEnabled( false ); setCursor( QCursor(Qt::WaitCursor) ); num_players = 0; // Criar o labirinto map_old = map; // Para o apagar *depois* de associar o novo aos QGLWidgets map = new Map( width, height ); ui->glViewMap->setMap( map ); ui->glView2D ->setMap( map ); ui->glView3D ->setMap( map ); // Apagar o labirinto anterior (se existir) if( map_old != NULL ) delete map_old; // Construir agora o labirinto MapCreate::walls ( map, complexity ); MapCreate::features( map ); // Posicionar os jogadores // Nota: por enquanto so' usamos um jogador (o jogador 0). Futuramente, // se quisermos mais de um jogador, eles devem ter um posicionamento // aleatorio dentro do labirinto, ou obtido pela rede. num = 1; for( p = 0; p < num; p++ ) { players[p].x = players[p].y = 1; players[p].compass = Compass( Compass::NORTH ); // this->map->setPlayer() e' chamado por this->draw2d() e this->draw3d() } current_player = 0; num_players = num; draw2d(); draw3d(); // Feedback visual de "pronto a jogar" setCursor( QCursor(Qt::ArrowCursor) ); ui->pushNew->setEnabled( true ); resetStatePlay(); }
/* GLTexture::draw2dTiled * Draws the texture tiled within an area [width]x[height]. Returns * false if the texture isn't loaded, true otherwise *******************************************************************/ bool GLTexture::draw2dTiled(uint32_t width, uint32_t height) { // Can't draw if texture not loaded if (!loaded || tex.empty()) return false; // If the texture isn't split, just draw it straight if (OpenGL::validTexDimension(width) && OpenGL::validTexDimension(height)) { // Bind the texture glBindTexture(GL_TEXTURE_2D, tex[0].id); // Calculate texture coordinates double tex_x = (double)width / (double)this->width; double tex_y = (double)height / (double)this->height; // Draw glBegin(GL_QUADS); glTexCoord2d(0, 0); glVertex2d(0, 0); glTexCoord2d(0, tex_y); glVertex2d(0, height); glTexCoord2d(tex_x, tex_y); glVertex2d(width, height); glTexCoord2d(tex_x, 0); glVertex2d(width, 0); glEnd(); } // Otherwise draw the 128x128 chunks else { uint32_t x = 0; while (x < width) { uint32_t y = 0; while (y < height) { // Draw texture draw2d(x, y); // Move down y += this->height; } // Move right x += this->width; } } return true; }
void draw(float stateBlend) { display->updateViewport(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (stereo.enabled) { int height = display->height(); int width = display->width(); float sep = stereo.separation; if (stereo.cross) { sep = -sep; } glViewport(0, height / 4, width / 2, height / 2); draw3d(stateBlend, narf::Matrix4x4f::translate(sep, 0, 0)); glViewport(width / 2, height / 4, width / 2, height / 2); draw3d(stateBlend, narf::Matrix4x4f::translate(-sep, 0, 0)); glViewport(0, 0, width, height); } else { draw3d(stateBlend, narf::Matrix4x4f::translate(0, 0, 0)); } draw2d(); display->swap(); if (screenshot) { screenshot = false; auto dwidth = static_cast<int>(display->width()); auto dheight = static_cast<int>(display->height()); SDL_Surface* image = SDL_CreateRGBSurface(SDL_SWSURFACE, dwidth, dheight, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0); glReadPixels(0, 0, dwidth, dheight, GL_RGB, GL_UNSIGNED_BYTE, image->pixels); narf::console->println("Taking a screenshot. " + std::to_string(image->w) + "x" + std::to_string(image->h) + "x24"); // Flip upside down auto linesize = image->w * 3; auto pixels = static_cast<uint8_t*>(image->pixels); auto halfHeight = image->h / 2; for (int32_t y = 0; y < halfHeight; y++) { auto p1 = pixels + y * linesize; auto p2 = pixels + (image->h - y - 1) * linesize; std::swap_ranges(p1, p1 + linesize, p2); } SDL_SaveBMP(image, "pic.bmp"); SDL_FreeSurface(image); } }
void MainWindow::on_pushTurnRight2D_clicked() { turnRight(); draw2d(); }
void MainWindow::on_pushMoveFwd2D_clicked() { moveFwd(); draw2d(); }
void MainWindow::on_pushTurnLeft2D_clicked() { turnLeft(); draw2d(); }
void NormalBlendedDecal::draw(void) { if ((m_width == 0) || (m_height == 0)) return; nv::matrix4f proj; nv::perspective(proj, 45.0f, (GLfloat)m_width / (GLfloat)m_height, 0.01f, 100.0f); float uScreenSize[] = { (float)m_width, (float)m_height, 0, 0 }; static const GLenum drawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 }; glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); // Draw world geometries into gbuffer { glBindFramebuffer(GL_FRAMEBUFFER, mGbufferFBO); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Enable all color buffers glDrawBuffers(3, drawBuffers); // Clear render targets static const GLfloat floatZeroes[] = { 0.0f, 0.0f, 0.0f, 0.0f }; static const GLfloat floatOnes[] = { 1.0f, 1.0f, 1.0f, 1.0f }; glClearBufferfv(GL_COLOR, 0, floatZeroes); glClearBufferfv(GL_COLOR, 1, floatZeroes); glClearBufferfv(GL_COLOR, 2, floatZeroes); glClearBufferfv(GL_DEPTH, 0, floatOnes); // Enable GBuffer program mGbufferProgram->enable(); // Draw scene objects for (unsigned int j = 0; j < mSqrtNumModels; j++) { for (unsigned int i = 0; i < mSqrtNumModels; i++) { // Model transform nv::matrix4f matModel; matModel.set_scale(1.0f); matModel.set_translate(nv::vec3f( .5f*mModelDistance*(mSqrtNumModels - 1.0f) - mModelDistance*i, .5f*mModelDistance*(mSqrtNumModels - 1.0f) - mModelDistance*j, 0.0f)); // Model view transform nv::matrix4f matMV = m_transformer->getModelViewMat() * matModel; // Movel view projection transform nv::matrix4f matMVP = proj * matMV; // Set uniforms mGbufferProgram->setUniformMatrix4fv("uModelViewMatrix", matMV._array); mGbufferProgram->setUniformMatrix4fv("uModelViewProjMatrix", matMVP._array); mGbufferProgram->setUniformMatrix4fv("uModelMatrix", matModel._array); // Draw model mModels[mModelID]->drawElements(0, 1, 2, 3); } } } // Draw decal box into gbuffer { glBindFramebuffer(GL_FRAMEBUFFER, mGbufferDecalFBO); // Enable only color buffer glDrawBuffers(1, drawBuffers); if (mViewOption == VIEW_DECAL_BOXES) { glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE); } mDecalProgram->enable(); // uNormalImage glBindImageTexture(0, mGbufferTextures[NORMAL_TEXTURE], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA16F); // uWorldPosTex glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, mGbufferTextures[WORLDPOS_TEXTURE]); mDecalProgram->setUniform4fv("uScreenSize", uScreenSize); mDecalProgram->setUniform1i("uShowDecalBox", (mViewOption == VIEW_DECAL_BOXES) ? true : false); float gridSize = mModelDistance*(mSqrtNumModels - 1.0f); for (unsigned int idx = 0; idx < mNumDecals; idx++) { nv::matrix4f matDecal; matDecal.make_identity(); matDecal.set_scale(nv::vec3f(mDecalSize, mDecalSize, 2.0f)); matDecal.set_translate(nv::vec3f(gridSize*mDecalDistance*mDecalPos[idx].x, gridSize*mDecalDistance*mDecalPos[idx].y, 0)); nv::matrix4f matMVP = proj * m_transformer->getModelViewMat() * matDecal; nv::matrix4f invMVP = inverse(matMVP); nv::matrix4f invModel = inverse(matDecal); mDecalProgram->setUniformMatrix4fv("uModelMatrix", matDecal._array); mDecalProgram->setUniformMatrix4fv("uInvModelMatrix", invModel._array); mDecalProgram->setUniformMatrix4fv("uModelViewProjMatrix", matMVP._array); mDecalProgram->setUniformMatrix4fv("uViewMatrix", m_transformer->getModelViewMat()._array); float weight = mBlendWeight; for (int blendIdx = 0; blendIdx < NUM_DECAL_BLENDS; ++blendIdx) { // uDecalNormalTex glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, mDecalNormals[blendIdx]); mDecalProgram->setUniform1f("uBlendWeight", weight); weight = (blendIdx == (NUM_DECAL_BLENDS - 2)) ? (1.0f - weight) : weight*mBlendWeight; // Draw decal cube mCube->drawElements(0, 1, 2, 3); if (mLock == LOCK_MEMORY_BARRIER) { glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); } } } // Restore states glEnable(GL_DEPTH_TEST); glDisable(GL_BLEND); } // Draw combiner pass { // Back to main FBO glBindFramebuffer(GL_FRAMEBUFFER, getMainFBO()); // Disable depth testing glDisable(GL_DEPTH_TEST); // Enable combiner program mCombinerProgram->enable(); // uColorTex glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, mGbufferTextures[COLOR_TEXTURE]); // uNormalTex glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, mGbufferTextures[NORMAL_TEXTURE]); // Set decal box option mCombinerProgram->setUniform1i("uShowDecalBox", (mViewOption == VIEW_DECAL_BOXES) ? true : false); // Set decal box option mCombinerProgram->setUniform1i("uShowNormals", (mViewOption == VIEW_NORMALS) ? true : false); // Set light direction nv::matrix4f invViewMatrix = inverse(m_transformer->getModelViewMat()); nv::vec4f lightDir = invViewMatrix * nv::vec4f(0, 0, 1.0f, 0); lightDir = normalize(lightDir); mCombinerProgram->setUniform4fv("uLightDir", lightDir); // Set view direction nv::vec4f viewDir = invViewMatrix * nv::vec4f(0, 0, -1.0f, 0); viewDir = normalize(viewDir); mCombinerProgram->setUniform4fv("uViewDir", viewDir); // Draw combiner program with screen quad draw2d(0, mCombinerProgram); // Restore states glEnable(GL_DEPTH_TEST); } }
int main(int argc, char *argv[]) { // init glfw if ( glfwInit( ) == GL_FALSE) { std::cerr << std::endl; std::cerr << std::endl << "ERROR while calling glfwInit()"; return EXIT_FAILURE; } std::cerr << std::endl; std::cerr << std::endl << "glfw initialised..."; std::cerr << std::endl; std::flush(std::cout); // Open an OpenGL window // glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_FALSE); // glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 16); // glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); if( !glfwOpenWindow( g_screenWidth, g_screenHeight, 0,0,0,0,0,0, GLFW_WINDOW ) ) { std::cerr << std::endl << "ERROR while calling glfwOpenWindow(...)"; glfwTerminate(); return EXIT_FAILURE; } glfwSetWindowPos( 500, 0); glfwSetWindowSizeCallback(resize); glfwSetKeyCallback(key); /// initialize GLEW if (GLEW_OK != glewInit()) { /// ... or die trying std::cout << "'glewInit()' failed." << std::endl; exit(0); } /// set some gl states glEnable(GL_TEXTURE_2D); /// enable texture support glEnable(GL_DEPTH_TEST); /// enable z-buffering glDepthFunc(GL_LEQUAL); // glfwSwapInterval( 1 ); // glfwSwapBuffers(); /// load and intialize stuff for our demo init(); // Main loop int running = GL_TRUE; while( running ) { double startTime = glfwGetTime(); // OpenGL rendering goes here... glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); frameStep(); draw2d(); // Swap front and back rendering buffers glfwSwapBuffers(); // Check if ESC key was pressed or window was closed running = glfwGetWindowParam( GLFW_OPENED ); g_timePerFrame = glfwGetTime() - startTime; } glfwCloseWindow(); glfwTerminate(); /// cleanup all resources we created for the demo cleanup(); return EXIT_SUCCESS; }
void ofxAruco::draw() { if ( camParams.isValid() ) draw3d(); else draw2d(); }
void stepGoto(s16 x, s16 y, s16 z) { draw2d(x, y); }
void display_images(IMAGE *image_w, IMAGE *image_n, IMAGE *match_image) { WINDOW w_im_window; WINDOW n_im_window; WINDOW match_window; GRAPHICS_EVENT event; //output event INT16 i; // xmin xmax ymin ymax w_im_window = create_window ("Image 1", SCROLLINGWIN, 20, 100, 10 * image_w->get_xsize (), 10 * image_w->get_ysize (), 0, image_w->get_xsize (), 0, image_w->get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(w_im_window); show_sub_image (image_w, 0, 0, image_w->get_xsize (), image_w->get_ysize (), w_im_window, 0, 0); line_color_index(w_im_window, RED); for (i = 1; i < image_w->get_xsize (); i++) { move2d (w_im_window, i, 0); draw2d (w_im_window, i, image_w->get_ysize ()); } for (i = 1; i < image_w->get_ysize (); i++) { move2d (w_im_window, 0, i); draw2d (w_im_window, image_w->get_xsize (), i); } // xmin xmax ymin ymax n_im_window = create_window ("Image 2", SCROLLINGWIN, 240, 100, 10 * image_n->get_xsize (), 10 * image_n->get_ysize (), 0, image_n->get_xsize (), 0, image_n->get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(n_im_window); show_sub_image (image_n, 0, 0, image_n->get_xsize (), image_n->get_ysize (), n_im_window, 0, 0); line_color_index(n_im_window, RED); for (i = 1; i < image_n->get_xsize (); i++) { move2d (n_im_window, i, 0); draw2d (n_im_window, i, image_n->get_ysize ()); } for (i = 1; i < image_n->get_ysize (); i++) { move2d (n_im_window, 0, i); draw2d (n_im_window, image_n->get_xsize (), i); } overlap_picture_ops(TRUE); // xmin xmax ymin ymax match_window = create_window ("Match Result", SCROLLINGWIN, 460, 100, 10 * match_image->get_xsize (), 10 * match_image->get_ysize (), 0, match_image->get_xsize (), 0, match_image->get_ysize (), TRUE, FALSE, FALSE, TRUE); // down event & key only clear_view_surface(match_window); show_sub_image (match_image, 0, 0, match_image->get_xsize (), match_image->get_ysize (), match_window, 0, 0); line_color_index(match_window, RED); for (i = 1; i < match_image->get_xsize (); i++) { move2d (match_window, i, 0); draw2d (match_window, i, match_image->get_ysize ()); } for (i = 1; i < match_image->get_ysize (); i++) { move2d (match_window, 0, i); draw2d (match_window, match_image->get_xsize (), i); } overlap_picture_ops(TRUE); await_event(match_window, TRUE, ANY_EVENT, &event); destroy_window(w_im_window); destroy_window(n_im_window); destroy_window(match_window); }
void drawDelphes1(TString plotsToMake="all") { initSamples(); setOutputDirectory("Delphes1"); int nbins; float low,high; TString var,xtitle; doOverflowAddition(true); doRatio_=false; //normalize to unit area setStackMode(false,true,false); //stack,norm,label override stackSignal_=false; selection_ = "(1)"; //no cuts! nbins=40; low=0; high=1000; var="MET"; xtitle="MET (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("001")) drawPlots(var,nbins,low,high,xtitle,"Events", "MET",0,"GeV"); selection_ = "(1)"; //no cuts! nbins=50; low=0; high=3000; var="HT"; xtitle="HT (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("002")) drawPlots(var,nbins,low,high,xtitle,"Events", "HT",0,"GeV"); selection_ = "(1)"; //no cuts! nbins=14; low=0; high=14; var="njets40"; xtitle="njets (40 GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("003")) drawPlots(var,nbins,low,high,xtitle,"Events", "njets40",0,""); selection_ = "(1)"; //no cuts! nbins=6; low=0; high=6; var="nbjets40tight"; xtitle="n tight b jets (40 GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("004")) drawPlots(var,nbins,low,high,xtitle,"Events", "nTbjets40",0,""); selection_ = "(1)"; //no cuts! nbins=50; low=0; high=2000; var="MT2"; xtitle="MT2 (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("005")) drawPlots(var,nbins,low,high,xtitle,"Events", "MT2",0,"GeV"); //edge selection cuts TCut dileptons="mll>20"; TCut sf = "isSF==1"; TCut jetsloose = "njets30eta3p0>=2"; TCut jetstight = "njets30eta3p0>=3"; TCut metloose = "MET>100"; TCut mettight = "MET>150"; selection_ = dileptons&&sf&&jetsloose&&mettight; //Edge selection 1 nbins=60; low=0; high=300; var="mll"; xtitle="m_{l+l-} (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("006")) drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mll",0,"GefV"); //same plot, zoom on low mass region nbins=100; low=0; high=100; var="mll"; xtitle="m_{l+l-} (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("012")) drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mll_zoom",0,"GeV"); if (plotsToMake=="013") {//not compatible with other plots clearSamples(); addSample("susyhit_slhaScenario1_v02",kRed,"Scenario 1"); drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mll_zoom_sigonly",0,"GeV"); nbins=100; low=0; high=500; drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mll_wide_sigonly",0,"GeV"); selection_ = dileptons&&!sf&&jetsloose&&mettight; //sanity check -- veto SF drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mllOF_zoom_sigonly",0,"GeV"); } //also show with 'real' normalization setStackMode(true,false,false); //stack,norm,label override stackSignal_=false; if (plotsToMake.Contains("all")||plotsToMake.Contains("007")) drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel1_mll",0,"GeV"); setStackMode(false,true,false); //stack,norm,label override selection_ = dileptons&&sf&&jetstight&&metloose; //Edge selection 2 nbins=50; low=0; high=300; var="mll"; xtitle="m_{l+l-} (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("008")) drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel2_mll",0,"GeV"); //also show with 'real' normalization setStackMode(true,false,false); //stack,norm,label override stackSignal_=false; if (plotsToMake.Contains("all")||plotsToMake.Contains("009")) drawPlots(var,nbins,low,high,xtitle,"Events", "edge_sel2_mll",0,"GeV"); //now try a hadronic analysis selection TCut noleptons = "nElectrons==0 && nMuons==0"; TCut ht600 = "HT>=600"; TCut jets="njets40>=3"; selection_=noleptons && ht600 && metloose && jets; nbins=40; low=0; high=800; var="MT2"; xtitle="MT2 (GeV)"; setStackMode(false,true,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("010")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_presel_MT2",0,"GeV"); setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("011")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_presel_MT2",0,"GeV"); //try an MT2 cut instead? TCut mt2baseline = "MT2>=200"; selection_=noleptons&&ht600&&jets&&mt2baseline; nbins=40; low=0; high=2000; var="HT"; xtitle="HT (GeV)"; setStackMode(false,true,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("014")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel_HT",0,"GeV"); setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("014")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel_HT",0,"GeV"); //cut much tighter on HT and plot MT2 TCut tighterht = "HT>1500"; selection_ = noleptons && tighterht && jets && mt2baseline; //plot MT2 and njets nbins=40; low=0; high=2000; var="MT2"; xtitle="MT2 (GeV)"; setStackMode(false,true,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("015")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel2_MT2",0,"GeV"); setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("015")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel2_MT2",0,"GeV"); nbins=12; low=0; high=12; var="njets40"; xtitle="njets40 (GeV)"; setStackMode(false,true,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("015")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel2_njets40",0,"GeV"); setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("015")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel2_njets40",0,"GeV"); //tighter further! TCut tightermt2 = "MT2>350"; TCut tighterjets = "njets40>=8"; selection_ = noleptons&&TCut("HT>1000")&&tightermt2&&tighterjets; //plot HT again nbins=40; low=1000; high=3000; var="HT"; xtitle="HT (GeV)"; setStackMode(true,false,false); //stack,norm,label override customDivisionsVal_ = 505; customDivisions_=true; if (plotsToMake.Contains("all")||plotsToMake.Contains("016")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel3_HT",0,"GeV"); customDivisions_=false; //ok, now we're getting somewhere! TCut ht2000="HT>2000"; selection_ = noleptons && ht2000 && tightermt2 && tighterjets; //nbjets nbins=9; low=0; high=9; var="nbjets40tight"; xtitle="n tight b tags"; setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("017")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel4_nbjets",0,""); //ntaus nbins=3; low=0; high=3; var="nTaus"; xtitle="n tau tags"; setStackMode(true,false,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("017")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel4_ntaus",0,""); setStackMode(false,true,false); //stack,norm,label override if (plotsToMake.Contains("all")||plotsToMake.Contains("017")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel4_ntaus",0,""); //and MT2 setStackMode(true,false,false); //stack,norm,label override selection_ = noleptons && ht2000 && TCut("MT2>250") && tighterjets; nbins=65; low=250; high=1000; var="MT2"; xtitle="MT2 (GeV)"; if (plotsToMake.Contains("all")||plotsToMake.Contains("017")) drawPlots(var,nbins,low,high,xtitle,"Events", "hadronic_mt2sel4_mt2",0,"GeV"); //try a 2d plot selection_ = noleptons && TCut("HT>800") && TCut("MT2>200") && tighterjets; if (plotsToMake.Contains("all")||plotsToMake.Contains("018")) draw2d("MT2",15,200,500,"HT",15,800,3000,"MT2","HT", "hadronic_mt2sel5_mt2Vht",0,0,"susyhit_slhaScenario1_v02"); }
void TransIcelandicExpress::redraw( void ) { static tex_init = 0; if (!tex_init) { ilutRenderer( ILUT_OPENGL ); ilGenImages( 1, &ImageName ); ilBindImage( ImageName ); glEnable( GL_TEXTURE_2D ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); if (!ilLoadImage( "ludum48.png" )) { printf("Loading image failed\n"); } gl_tex_id = ilutGLBindTexImage(); ilutGLTexImage( 0 ); tex_init = 1; } glBindTexture (GL_TEXTURE_2D, gl_tex_id ); glClearColor( 0.3f, 0.4f, 0.6f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); //glEnable( GL_CULL_FACE ); glEnable( GL_DEPTH_TEST ); // 3d part glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective( 60.0, 800.0/600.0, 0.05, 100.0 ); gluLookAt( player->pos[0]+cameraPos[0], player->pos[1]+cameraPos[1]+c_PlayerHeight, player->pos[2]+cameraPos[2], player->pos[0], player->pos[1]+ c_PlayerHeight, player->pos[2], 0.0, 1.0, 0.0 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); // apply some of the camera xform to the light just to make // it more shiny glPushMatrix(); float viewHead = atan2( cameraPos[2], cameraPos[0] ); glRotated( viewHead * SG_RADIANS_TO_DEGREES, 0.0f, 1.0f, 0.0f ); setupLights(); glPopMatrix(); draw3d(); // 2d part glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluOrtho2D( 0, 800, 0, 600 ) ; glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glDisable( GL_LIGHTING ); draw2d(); SDL_GL_SwapBuffers(); }