本文整理汇总了C++中Light::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::Init方法的具体用法?C++ Light::Init怎么用?C++ Light::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//--Main
int main(int argc, char **argv)
{
//Initialize GLUT
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(w, h);
Lighting.Init();////////////// ADD
// Name and create the Window
glutCreateWindow("LABYRINTH PROGRAM");
//temp Mesh model
Mesh tempMesh;
//add the number of holes values
numOfHoles.push_back(1);
numOfHoles.push_back(3);
numOfHoles.push_back(6);
level = 0;
//initialize textures
char metal_file[] = "../textures/metal.png";
char white_marble_file[] = "../textures/MarbleWhite.png";
char black_marble_file[] = "../textures/gold.png";
char red_solid_file[] = "../textures/red.png";
char green_solid_file[] = "../textures/green.png";
char black_solid_file[] = "../textures/black.png";
char brown_solid_file[] = "../textures/brown.png";
//load textures
Magick::InitializeMagick(*argv);
loadTexture(metal_file, metal);
loadTexture(black_marble_file, black_marble);
loadTexture(white_marble_file, white_marble);
loadTexture(red_solid_file, red_solid);
loadTexture(black_solid_file, black_solid);
loadTexture(green_solid_file, green_solid);
loadTexture(brown_solid_file, brown_solid);
GLenum status = glewInit(); //check glut status
if( status != GLEW_OK)
{
std::cerr << "[F] GLEW NOT INITIALIZED: ";
std::cerr << glewGetErrorString(status) << std::endl;
return -1;
}
//Set all of the callbacks to GLUT that we need
glutDisplayFunc(render); // Called when its time to display
glutReshapeFunc(reshape); // Called if the window is resized
glutIdleFunc(update); // Called if there is nothing else to do
glutKeyboardFunc(keyboard); // Called if there is keyboard input
glutMouseFunc(mouse);
glutMotionFunc(mouseOnTheMove);
//Initialize all of our resources
shaderManager = new ShaderManager();
bool init = initialize(); //initialize shaders and load models
//build mesh objects
tempMesh.initialize("board");
tempMesh.initial_bound = meshManager.getBounds("board");
tempMesh.current_position = tempMesh.initial_bound;
boardMesh = tempMesh;
tempMesh.initialize("sphere");
tempMesh.initial_bound = meshManager.getBounds("sphere");
tempMesh.current_position = tempMesh.initial_bound;
sphereMesh = tempMesh;
//initialize maze
buildMaze( abs(boardMesh.initial_bound.second.z - boardMesh.initial_bound.first.z) - 1,
abs(boardMesh.initial_bound.second.x - boardMesh.initial_bound.first.x) - 1);
//translate the ball to the start position
ballSetStart();
//initialize menus
createMenus();
if(init)
{
t1 = std::chrono::high_resolution_clock::now();
glutMainLoop();
}
return 0;
}