本文整理汇总了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();
}
}
示例2: viewport_draw
void viewport_draw(t_viewport *viewport)
{
t_context *C = ctx_get();
op_3d_orientation();
draw_scene(C->draw,C->scene);
}
示例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;
}
}
}
示例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();
}
示例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();
}
示例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);
}
}
}
示例7: display
void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw_scene();
glutSwapBuffers();
}
示例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();
}
示例9: my_display
void
GLUTCALLBACK my_display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
draw_scene();
glutSwapBuffers();
}
示例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;
}
示例11: display
void
TrackballViewer::
display()
{
draw_scene(draw_mode_);
// switch back-buffer to front-buffer
glutSwapBuffers();
}
示例12: nebulus_draw
static int nebulus_draw (NebulusPrivate *priv, VisVideo *video)
{
draw_scene ();
glFinish ();
nebulus_calc_fps (priv);
return 0;
}
示例13: display
static void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
draw_scene();
glutSwapBuffers();
}
示例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();
}
示例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;
}