Example #1
0
int main( int argc, char **argv )
{
    int success = 0;
    int gl_major, gl_minor;
    GLchar *VertexShaderSource, *FragmentShaderSource;

    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutInitWindowSize(500, 500);
    window = glutCreateWindow( "3Dlabs Brick Shader");

    glutIdleFunc(play);
    glutDisplayFunc(display);
    glutKeyboardFunc(key);
    glutReshapeFunc(reshape);
    glutMotionFunc(motion);
    glutMouseFunc(mouse);
    glutSpecialFunc(special);
    glutTimerFunc(TIMER_FREQUENCY_MILLIS , timer, 0);

    // Initialize the "OpenGL Extension Wrangler" library
    glewInit();

    // Make sure that OpenGL 2.0 is supported by the driver
    getGlVersion(&gl_major, &gl_minor);
    printf("GL_VERSION major=%d minor=%d\n", gl_major, gl_minor);

    if (gl_major < 2)
    {
        printf("GL_VERSION major=%d minor=%d\n", gl_major, gl_minor);
        printf("Support for OpenGL 2.0 is required for this demo...exiting\n");
        exit(1);
    }

    glDepthFunc(GL_LESS);
    glEnable(GL_DEPTH_TEST);
    NextClearColor();

    key('?', 0, 0);     // display help
#if 0
    readShaderSource("brick", &VertexShaderSource, &FragmentShaderSource);
#else
    readShaderSource("cloud", &VertexShaderSource, &FragmentShaderSource);
#endif
    success = installBrickShaders(VertexShaderSource, FragmentShaderSource);

    CreateNoise3D();

    if (success)
        glutMainLoop();
    
    return 0;
}
Example #2
0
void GLRenderer::initOpenGL() {
    glClearColor(0.f, 0.f, 0.f, 1.0f);
    mViewWidth = 1200;
    mViewHeight = 800;
    reshape(1200, 800);
    
    mScreenQuadModel = new ScreenQuadModel;
    mScreenQuadModel->buildVAO();
    createParticleBuffers();
    mVelocityTexture = CreateNoise3D();
    //createVelocityTexture();
    
    initBillboardShader();
    initFeedbackShader();
    mTestShader = new TestShader;
    
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    glEnable(GL_DEPTH_TEST);
    
    render(0.0);
}