• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ draw_scene函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: draw_object

/* draw the user object */
static int  draw_object(int obj_id, double gl_para[16])
{
	GLfloat   mat_ambient[] = { 0.0, 0.0, 1.0, 1.0 };
	GLfloat   mat_ambient_collide[] = { 1.0, 0.0, 0.0, 1.0 };
	GLfloat   mat_flash[] = { 0.0, 0.0, 1.0, 1.0 };
	GLfloat   mat_flash_collide[] = { 1.0, 0.0, 0.0, 1.0 };
	GLfloat   mat_flash_shiny[] = { 50.0 };
	GLfloat   light_position[] = { 100.0, -200.0, 200.0, 0.0 };
	GLfloat   ambi[] = { 0.1, 0.1, 0.1, 0.1 };
	GLfloat   lightZeroColor[] = { 0.9, 0.9, 0.9, 0.1 };

	argDrawMode3D();
	argDraw3dCamera(0, 0);
	glMatrixMode(GL_MODELVIEW);
	glLoadMatrixd(gl_para);

	/* set the material */
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_POSITION, light_position);
	glLightfv(GL_LIGHT0, GL_AMBIENT, ambi);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor);

	glMaterialfv(GL_FRONT, GL_SHININESS, mat_flash_shiny);

	switch (obj_id){
	case 0:
		glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);
		glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
		glColor3f(1.0, 2.0, 0.0);

		//glTranslated(10.0, 20.0, -100.0);
		draw_scene();
		//glTranslated(-10.0, -20.0, 100.0);
		break;
	case 1:
		glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);
		glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
		glColor3f(1.0, 0.0, 0.0);
		//draw piano left
			break;
	case 2:
		
			glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);
			glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
			glColor3f(1.0, 2.0, 0.0);
			draw_controller(distX/4, distY/4);
		break;
		}
		argDrawMode2D();

		return 0;
	}
开发者ID:ei08047,项目名称:soundAR,代码行数:54,代码来源:arSound.c


示例17: onOnceBeforeDraw

    void onOnceBeforeDraw() override {
        SkPictureRecorder recorder;
        SkCanvas* pictureCanvas = recorder.beginRecording(kPictureSize, kPictureSize);
        draw_scene(pictureCanvas, kPictureSize);
        SkAutoTUnref<SkPicture> picture(recorder.endRecording());

        SkPoint offset = SkPoint::Make(100, 100);
        pictureCanvas = recorder.beginRecording(SkRect::MakeXYWH(offset.x(), offset.y(),
                                                                 kPictureSize, kPictureSize));
        pictureCanvas->translate(offset.x(), offset.y());
        draw_scene(pictureCanvas, kPictureSize);
        SkAutoTUnref<SkPicture> offsetPicture(recorder.endRecording());

        for (unsigned i = 0; i < SK_ARRAY_COUNT(tiles); ++i) {
            SkRect tile = SkRect::MakeXYWH(tiles[i].x * kPictureSize,
                                           tiles[i].y * kPictureSize,
                                           tiles[i].w * kPictureSize,
                                           tiles[i].h * kPictureSize);
            SkMatrix localMatrix;
            localMatrix.setTranslate(tiles[i].offsetX * kPictureSize,
                                     tiles[i].offsetY * kPictureSize);
            localMatrix.postScale(kFillSize / (2 * kPictureSize),
                                  kFillSize / (2 * kPictureSize));

            SkPicture* picturePtr = picture.get();
            SkRect* tilePtr = &tile;

            if (tile == SkRect::MakeWH(kPictureSize, kPictureSize)) {
                // When the tile == picture bounds, exercise the picture + offset path.
                picturePtr = offsetPicture.get();
                tilePtr = NULL;
            }

            fShaders[i].reset(SkShader::CreatePictureShader(picturePtr,
                                                            SkShader::kRepeat_TileMode,
                                                            SkShader::kRepeat_TileMode,
                                                            &localMatrix,
                                                            tilePtr));
        }
    }
开发者ID:webbjiang,项目名称:skia,代码行数:40,代码来源:pictureshadertile.cpp


示例18: display

void display() {
	glClearColor(0,0.6,0.7,1);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
		glRotatef(x_rot,1,0,0);
		glRotatef(y_rot,0,1,0);
		glLightfv(GL_LIGHT0,GL_POSITION,dir_position);
		draw_scene();
	glPopMatrix();

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


示例19: processInput

//---------------------------------------------------------------------------
void emberManager::update()
{
	processInput();
	// 绘制合适的场景
	if( isFight )
	{
		drawFightScene( ember, evil );
		isFight = false;
	}
	else
	{
		draw_scene();
	}
}
开发者ID:spiritpig,项目名称:myPracticeCode,代码行数:15,代码来源:emberManager.cpp


示例20: templateAppDraw

void templateAppDraw( void ) {

	glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );

	GFX_set_matrix_mode( PROJECTION_MATRIX );
	GFX_load_identity();
	
	GFX_set_perspective( 45.0f,
						 ( float )viewport_matrix[ 2 ] / ( float )viewport_matrix[ 3 ],
						 0.1f,
						 100.0f,
						 -90.0f );
	
	draw_scene();
}
开发者ID:crlarsen,项目名称:gamelibrary,代码行数:15,代码来源:templateApp.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ draw_screen_locked函数代码示例发布时间:2022-05-30
下一篇:
C++ draw_rectangle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap