Example #1
0
Renderer::Renderer( Level* l, Player* p ):
    level(l), player(p), scene_scale(0.25f)
{

    int v[4];
    glGetIntegerv( GL_VIEWPORT, v );
    screen_x= v[2];
    screen_y= v[3];


    microbes_vbo.VertexData( NULL, sizeof(MicrobeVertex) * 1024, sizeof(MicrobeVertex) );
    microbes_vbo.IndexData( NULL, 1024 * sizeof(short) );

    microbes_shader.SetAttribLocation( "v", 0 );
    microbes_shader.SetAttribLocation( "c", 1 );
    microbes_shader.Create( microbe_shader_v, microbe_shader_f );
    microbes_shader.FindUniform( "m" );//transform matrix, uniform No 0


    glGenTextures( 1, &background_texture );
    glBindTexture( GL_TEXTURE_2D, background_texture );

    unsigned char* bg_data= GenBackground( screen_x, screen_y );

    glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
    glTexImage2D( GL_TEXTURE_2D, 0, 1,
                  screen_x, screen_y, 0,
                  GL_RED,  GL_UNSIGNED_BYTE, bg_data );

    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );


    // GenRoundBody( &part_meshes[ PART_ROUND_BODY ] );
    // GenDefaultShell( &part_meshes[ PART_DEFAULT_SHELL ] );
    //GenDefaultNucleus( &part_meshes[ PART_DEFAULT_NUCLEUS ] );
    //GenFlagellum( &part_meshes[ PART_FLAGELLUM ] );
    for( int i= 0; i< PART_COUNT; i++ )
        generation_func_table[i]( &part_meshes[i] );


}
bool ModuleSceneIntro::Start()
{
	LOG("Loading Intro assets");
	bool ret = true;
	draw = true;
	magnet = false;
	ballsToAdd = 1;
	launcherReady = true;
	ballLaunched = true;
	started = false;
	lifes = 3;
	textBallSaved = TEXT_CHANGE_DELAY+1;
	textExtraBall = TEXT_CHANGE_DELAY+1;

	LoadAssets();

	GenBackground();

	return ret;
}