void initGraphics() {

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    eyeVector = vec3(0.0,0.0,defaultEyeZ);
    upVector = vec3(0.0,1.0,0.0);
    centerVector = vec3(0,0,0);

    initializeAnimation();
    //initialize display lists
    initCircleThingy();
    initTorus();
    initSpaceStation();
    initMouse();

    //initialize shaders
    vertexShader = initshaders(GL_VERTEX_SHADER, "vertexShader.glsl");
    fragmentShader = initshaders(GL_FRAGMENT_SHADER, "fragmentShader.glsl");
    shaderProgram = initprogram(vertexShader,fragmentShader);

//link up variables in shaders
//
    computingTeapot = glGetUniformLocation(shaderProgram,"computingTeapot");
    computingSphere = glGetUniformLocation(shaderProgram,"computingSphere");
    centerDist = glGetUniformLocation(shaderProgram, "centerDist");
    computingTorus = glGetUniformLocation(shaderProgram, "computingTorus");
    torusTransparency = glGetUniformLocation(shaderProgram, "torusTransparency");
    materialDiffuse = glGetUniformLocation(shaderProgram, "materialDiffuse");
    materialSpecular = glGetUniformLocation(shaderProgram, "materialSpecular");
    materialShininess = glGetUniformLocation(shaderProgram, "materialShininess");
    viewMatrix = glGetUniformLocation(shaderProgram, "viewMatrix");
    usingTextures = glGetUniformLocation(shaderProgram, "usingTextures");
    computingMonitor = glGetUniformLocation(shaderProgram, "computingMonitor");

    //initialize textures
    initSphereTexture(fragmentShader);

}
示例#2
0
文件: roller.cpp 项目: berise/wxTorus
TRoller::TRoller()
	:	m_Level( 3 )		//	basic level
{
	initTorus();
}