Esempio n. 1
0
// ------------------------------------------------------------------- init ---
void init( void )
{
    control_key_handled = 0;

    console = console_new();
    console_print( console,
                   "OpenGL Freetype console\n"
                   "Copyright 2011 Nicolas P. Rougier. All rights reserved.\n \n" );
    console_connect( console, "activate",     console_activate );
    console_connect( console, "complete",     console_complete );
    console_connect( console, "history-prev", console_history_prev );
    console_connect( console, "history-next", console_history_next );

    glClearColor( 1.00, 1.00, 1.00, 1.00 );
    glDisable( GL_DEPTH_TEST );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
    glEnable( GL_TEXTURE_2D );
    glEnable( GL_BLEND );

    shader = shader_load("shaders/v3f-t2f-c4f.vert",
                         "shaders/v3f-t2f-c4f.frag");
    mat4_set_identity( &projection );
    mat4_set_identity( &model );
    mat4_set_identity( &view );
}
static void lnp_console_execute_command(char *out_buffer, int buffer_len, 
		int function_id, char *args) {
	switch (function_id) {
		case COMMAND_ID:
			console_id(out_buffer, buffer_len, args);
			break;
		case COMMAND_WRITE:
			console_write(out_buffer, buffer_len, args);
			break;
		case COMMAND_READ:
			console_read(out_buffer, buffer_len, args);
			break;
		case COMMAND_FLUSH:
			console_flush(out_buffer, buffer_len, args);
			break;
		case COMMAND_CONNECTIONS:
			console_connections(out_buffer, buffer_len, args);
			break;
		case COMMAND_HISTORY:
			console_history(out_buffer, buffer_len, args);
			break;
		case COMMAND_CONNECT:
			console_connect(out_buffer, buffer_len, args);
			break;
		case COMMAND_KEYS:
			console_print_keys(out_buffer, buffer_len, args);
			break;
	}
}
Esempio n. 3
0
int
main( int argc, char **argv )
{
    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    glutCreateWindow( argv[0] );
    glutReshapeFunc( on_reshape );
    glutDisplayFunc( on_display );
    glutKeyboardFunc( on_key_press );
    glutSpecialFunc( on_special_key_press );
    glutReshapeWindow( 600,400 );
#ifndef __APPLE__
    glewExperimental = GL_TRUE;
    GLenum err = glewInit();
    if (GLEW_OK != err)
    {
        /* Problem: glewInit failed, something is seriously wrong. */
        fprintf( stderr, "Error: %s\n", glewGetErrorString(err) );
        exit( EXIT_FAILURE );
    }
    fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
    console = console_new();
    console_print( console,
                   L"OpenGL Freetype console\n"
                   L"Copyright 2011 Nicolas P. Rougier. All rights reserved.\n \n" );
    console_connect( console, "activate",     console_activate );
    console_connect( console, "complete",     console_complete );
    console_connect( console, "history-prev", console_history_prev );
    console_connect( console, "history-next", console_history_next );

    glClearColor( 1.00, 1.00, 1.00, 1.00 );
    glDisable( GL_DEPTH_TEST );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
    glEnable( GL_TEXTURE_2D );
    glEnable( GL_BLEND );

    shader = shader_load("shaders/v3f-t2f-c4f.vert",
                         "shaders/v3f-t2f-c4f.frag");
    mat4_set_identity( &projection );
    mat4_set_identity( &model );
    mat4_set_identity( &view );
    glutMainLoop();


    return 0;
}
void console_execute_command(char *out_buffer, int buffer_len, 
		int function_id, char *args) {
	switch (function_id) {
		case COMMAND_SESSIONS:
			console_print_sessions(out_buffer, buffer_len, args);
			break;
		case COMMAND_STATISTICS:
			console_print_statistics(out_buffer, buffer_len, args);
			break;
		case COMMAND_ALGORITHMS:
			console_print_algorithms(out_buffer, buffer_len, args);
			break;
		case COMMAND_DH_PARAMS:
			console_print_dh_params(out_buffer, buffer_len, args);
			break;
		case COMMAND_KEYS:
			console_print_keys(out_buffer, buffer_len, args);
			break;
		case COMMAND_CONNECT:
			console_connect(out_buffer, buffer_len, args);
			break;
		case COMMAND_DISCONNECT:
			console_disconnect(out_buffer, buffer_len, args);
			break;
		case COMMAND_CLOSE:
			console_close_session(out_buffer, buffer_len, args);
			break;
		case COMMAND_WRITE:
			console_write_data(out_buffer, buffer_len, args);
			break;
		case COMMAND_READ:
			console_read_data(out_buffer, buffer_len, args);
			break;
		case COMMAND_FLUSH:
			console_flush(out_buffer, buffer_len, args);
			break;
	}
}