コード例 #1
0
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();
}