void Demo3::initShaders() { addResPath("shaders/"); initShaderProgram("simple_v3_c4.vert", "simple_v3_c4.frag", 0); initShaderProgram("lambert_v3_c4_n3.vert", "lambert_v3_c4_n3.frag", 0); initShaderProgram("phong_v3_v4_n3.vert", "phong_v3_v4_n3.frag", 0); resetResPath(); }
void billboard_tech::init(){ //load and compile shaders loadShaders(); //link all shaders together initShaderProgram(); //get the variables from the shaders initShaderLocations(); //create the VAO glUseProgram(program); }
void grass_tech::init(){ //load and compile shaders loadShaders(); //link all shaders together initShaderProgram(); //get the variables from the shaders initShaderLocations(); tex = new Texture("../bin/terrain/grass.png", GL_TEXTURE_2D); pathTex = new Texture("../bin/terrain/path3.jpg", GL_TEXTURE_2D); //create the VAO glUseProgram(program); }
void initOpenGL() { glfwSetErrorCallback(error_callback); if (!glfwInit()) { printf("Failed to initialize GLFW\n"); exit(EXIT_FAILURE); } window = glfwCreateWindow(windowWidth, windowHeight, "OpenGL", NULL, NULL); if (!window) { printf("Could not open window with GLFW\n"); glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); // Callbacks glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetWindowCloseCallback(window, window_close_callback); glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, cursor_pos_callback); glfwSetMouseButtonCallback(window, mouse_button_callback); // start GLEW extension handler glewInit(); if (glewInit() != GLEW_OK) { printf("Failed to initialize GLEW\n"); exit(EXIT_FAILURE); } glEnable(GL_DEPTH_TEST); // enable depth-testing trackball(curquat, 0.0f, 0.0f, 0.0f, 0.0f); glClearColor(1.0f, 1.0f, 1.0f, 1.0f); program = initShaderProgram(); }