当前位置: 首页>>代码示例>>C++>>正文


C++ draw_scene函数代码示例

本文整理汇总了C++中draw_scene函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_scene函数的具体用法?C++ draw_scene怎么用?C++ draw_scene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了draw_scene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_ctrl_change

    virtual void on_ctrl_change()
    {
        if(m_benchmark.status())
        {
            int i;
            on_draw();
            update_window();

            scanline_rasterizer ras;

            pixfmt pixf(rbuf_window());
            base_renderer rb(pixf);
            solid_renderer solid(rb);
            draft_renderer draft(rb);

            char buf[256];
            if(m_draft.status())
            {
                start_timer();
                for(i = 0; i < 10; i++)
                {
                    draw_scene(ras, solid, draft);
                }
                sprintf(buf, "%3.3f milliseconds", elapsed_time());
            }
            else
            {
                double times[5];
                for(m_draw = 0; m_draw < 4; m_draw++)
                {
                    start_timer();
                    for(i = 0; i < 10; i++)
                    {
                        draw_scene(ras, solid, draft);
                    }
                    times[m_draw] = elapsed_time();
                }
                m_draw = 3;

                times[4]  = times[3];
                times[3] -= times[2];
                times[2] -= times[1];
                times[1] -= times[0];
            
                FILE* fd = fopen(full_file_name("benchmark"), "a");
                fprintf(fd, "%10.3f %10.3f %10.3f %10.3f %10.3f\n", 
                            times[0], times[1], times[2], times[3], times[4]);
                fclose(fd);
            

                sprintf(buf, "  pipeline  add_path         sort       render       total\n"
                             "%10.3f %10.3f %10.3f %10.3f %10.3f", 
                        times[0], times[1], times[2], times[3], times[4]);
            }
            message(buf);

            m_benchmark.status(false);
            force_redraw();
        }
    }
开发者ID:Bashakov,项目名称:agg,代码行数:60,代码来源:graph_test.cpp

示例2: viewport_draw

void viewport_draw(t_viewport *viewport)
{
	t_context *C = ctx_get();

	op_3d_orientation(); 
	draw_scene(C->draw,C->scene);
}
开发者ID:rvba,项目名称:minuit,代码行数:7,代码来源:viewport.c

示例3: draw_scene

/*
 * Run through one frame drawing cycle
 */
void SdlApp::step()
{
	if (!running) return;

	draw_scene();

	SDL_Event event;
	while ( SDL_PollEvent( &event ) )
	{
		switch( event.type )
		{
			case SDL_ACTIVEEVENT:
				//TODO: handle focus change
				break;			    
			case SDL_KEYDOWN:
				/* handle key presses */
				handle_key_press( &event.key.keysym );
				break;
			case SDL_QUIT:
				/* handle quit requests */
				tear_down();
				break;
			default:
				break;
		}
	}

}
开发者ID:jbryan,项目名称:rl_demo,代码行数:31,代码来源:sdl_app.cpp

示例4: display_view

void display_view(int const win_width, int const win_height)
{
	float const win_aspect = (float)win_width / (float)win_height;
	frustum.left = -(frustum.right = win_aspect);

	glViewport(0, 0, win_width, win_height);
	glClearColor(0.3, 0.3, 0.6, 1.);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glFrustum(
		frustum.left,
		frustum.right,
		frustum.bottom,
		frustum.top,
		frustum.near,
		frustum.far );
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glEnable(GL_DEPTH_TEST);

#if OPTION_MULTISAMPLE
	glEnable(GL_MULTISAMPLE);
#endif

	draw_scene();

	glutSwapBuffers();
}
开发者ID:StephenThomasUWTSD,项目名称:codesamples,代码行数:32,代码来源:frustum.c

示例5: draw

void draw(void)
{
  GLenum err;
  GLfloat secs = get_secs();
  
  glDisable(GL_STENCIL_TEST);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  
  if (!headsUp) glEnable(GL_STENCIL_TEST);
  draw_scene(secs, draw_passes, GL_BACK, 0, (unsigned)-1);
  glDisable(GL_STENCIL_TEST);

  if (headsUp) {
    /* draw a red floor on the original scene */
    glDisable(GL_LIGHTING);
    glBegin(GL_QUADS);
    glColor3f(1, 0, 0);
    glVertex3f(-1, -.95, 1);
    glVertex3f(1, -.95, 1);
    glVertex3f(1, -.95, -1);
    glVertex3f(-1, -.95, -1);    
    glEnd();
    glEnable(GL_LIGHTING);
  }

  err = glGetError();
  if (err != GL_NO_ERROR) printf("Error:  %s\n", gluErrorString(err));
  
  glutSwapBuffers(); 
}
开发者ID:AlexGreulich,项目名称:HRTFVR,代码行数:30,代码来源:multimirror.c

示例6: display

/// main draw method
void display() {
    hud_fps_display.start();
    if(draw_opts.cameralights) scene_cameralights_update(scene,draw_opts.cameralights_dir,draw_opts.cameralights_col);
    draw_scene(scene,draw_opts,true);
    draw_scene_decorations(scene,draw_opts,false);
    glFlush();
    hud_fps_display.stop();
    
    if(selected_frame) {
        auto axes = Axes();
        axes.frame = *selected_frame;
        draw_gizmo(&axes);
        if(selected_point) {
            auto dot = Dot();
            dot.pos = transform_point(*selected_frame, *selected_point);
            draw_gizmo(&dot);
        }
    }
    
    if(hud) display_hud();
    
    glutSwapBuffers();
    
    if(screenshotAndExit) {
        if(time_init_advance <= 0.0f or draw_opts.time >= time_init_advance ) {
            screenshot(filename_image.c_str());
            exit(0);
        }
    }
}
开发者ID:cpastuszenski,项目名称:cs77_assignment3,代码行数:31,代码来源:view.cpp

示例7: display

void
display(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  draw_scene();

  glutSwapBuffers();
}
开发者ID:AlexGreulich,项目名称:HRTFVR,代码行数:8,代码来源:hanoi2.c

示例8: display

void display()						// main display routine
{
  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  draw_scene();  
  glFlush();
  glutSwapBuffers();
}
开发者ID:pombredanne,项目名称:anacrolix,代码行数:8,代码来源:opengl_stuff.c

示例9: my_display

void
GLUTCALLBACK my_display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);

    draw_scene();

    glutSwapBuffers();
}
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:9,代码来源:demo.cpp

示例10: main

/* Program entry point */
int main (int argc, char* argv[]) {
   debug=fopen("debug.txt","w");

    // window dimensions
    int width  = 640;
    int height = 480;
    const SDL_VideoInfo *info;

    /* initialize SDL's video subsystem */
    if (SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
        fprintf( stderr, "Video initialization failed: %s\n", SDL_GetError( ) );
        return -1;
    }

    /* retrieve video information */
    info = SDL_GetVideoInfo( );
    if (!info) {
        fprintf( stderr, "Video query failed: %s\n", SDL_GetError( ) );
        return -1;
    }

    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,   8 ); /* min 8bit red */
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8 ); /* min 8bit green */
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,  8 ); /* min 8bit blue */
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); /* 16bit depth buffer */
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); /* require double buffering */

    /* Set video mode */
    SDL_Surface * surface = SDL_SetVideoMode(width, height, info->vfmt->BitsPerPixel, SDL_OPENGL);
    if (!surface) {
        fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) );
        return -1;
    }

    /* OpenGL initialization */
    setup_opengl(width, height);

    init();
    lys();
    tekstur();

    /* main event loop */
    while (running) {
      animer();
        /* Process incoming events */
        process_events();
        /* Draw the screen */
        draw_scene();

      sprett();
        SDL_Delay(1000/500); /* limit to 5fps */
    }

    SDL_Quit(); /* unload SDL */
    fclose(debug);
    return 0;
}
开发者ID:manish05,项目名称:TCR,代码行数:58,代码来源:o6.c

示例11: display

void 
TrackballViewer::
display()
{
	draw_scene(draw_mode_);	
	
	// switch back-buffer to front-buffer
	glutSwapBuffers();
}
开发者ID:Cyntix,项目名称:Grass_Rendering,代码行数:9,代码来源:TrackballViewer.cpp

示例12: nebulus_draw

static int nebulus_draw (NebulusPrivate *priv, VisVideo *video)
{
	draw_scene ();
	glFinish ();

	nebulus_calc_fps (priv);

	return 0;
}
开发者ID:Libvisual,项目名称:LibVisualAndroid,代码行数:9,代码来源:nebulus.c

示例13: display

static void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    draw_scene();

    glutSwapBuffers();
}
开发者ID:morankim,项目名称:midtermProject,代码行数:11,代码来源:sample.cpp

示例14: display

void display() {
	glClearColor(0,0,0.3,1);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glPushMatrix();
		glRotatef(y_rot,0,1,0);
		draw_scene();
	glPopMatrix();

	glutSwapBuffers();
}
开发者ID:MarcoGrillo,项目名称:OpenGL-Projects,代码行数:11,代码来源:table.cpp

示例15: idle

void idle()
{
  //hack to make it only draw once
  static int once=0;
  if(!once)
  {
      draw_scene();
      if(mode == MODE_JPEG)
	save_jpg();
    }
  once=1;
}
开发者ID:BachDinh1994,项目名称:RayTracer,代码行数:12,代码来源:assign3.cpp


注:本文中的draw_scene函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。