コード例 #1
0
ファイル: main.cpp プロジェクト: rsaxvc/vertifall
static void draw_screen( void )
{
static ship s;
/* Clear the color and depth buffers. */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glError();

/* We don't want to modify the projection matrix. */
glMatrixMode( GL_MODELVIEW );
glError();
glLoadIdentity( );
glError();
/* Move down the z-axis. */
glTranslatef( 0.0, 0.0, -15.0 ); glError();

glPushMatrix(); glError();

/* Rotate. */
//glRotatef( 100 * tim_x.read(), 1.0, 0.0, 0.0 );
//glRotatef( 100 * tim_y.read(), 0.0, 1.0, 0.0 );
//    glRotatef( 100 * tim_c.read(), 0.0, 0.0, 1.0 );

glTranslatef( 5 * tim_x.read(), 5 * tim_y.read(), 0 );
glError();

glBegin( GL_LINES );

#define BRICK_CNT 40//actually sqrt(brick count)
for( int x=-BRICK_CNT;x<BRICK_CNT;++x )
	{
	for( int y=-BRICK_CNT;y<BRICK_CNT;++y)
		{
		draw_rect(x,y,1,1,y==0,true);
		}
	}
glEnd();
glError();

glPopMatrix();
glError();

glRotatef( 100 * tim_x.read(), 1.0, 0.0, 0.0 );
glRotatef( 100 * tim_y.read(), 0.0, 1.0, 0.0 );

s.draw();

/*
 * Swap the buffers. This this tells the driver to
 * render the next frame from the contents of the
 * back-buffer, and to set all rendering operations
 * to occur on what was the front-buffer.
 */
SDL_GL_SwapBuffers( );
}
コード例 #2
0
ファイル: main.cpp プロジェクト: rsaxvc/vertifall
static void draw_screen( void )
{
/* Clear the color and depth buffers. */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glError();

/* We don't want to modify the projection matrix. */
glMatrixMode( GL_MODELVIEW );
glError();
glLoadIdentity( );
glError();
/* Move down the z-axis. */
glTranslatef( 0.0, 0.0, -15.0 ); glError();

s.draw();

/*
 * Swap the buffers. This this tells the driver to
 * render the next frame from the contents of the
 * back-buffer, and to set all rendering operations
 * to occur on what was the front-buffer.
 */
SDL_GL_SwapBuffers( );
}