Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <snippet>
- <content><![CDATA[
- #include <iostream>
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include <glm/glm.hpp>
- #include "shader.h"
- int main()
- {
- if( !glfwInit() )
- {
- std::cerr << "GLFW nije inicijaliziran\n";
- getchar();
- return -1;
- }
- glfwWindowHint(GLFW_SAMPLES, 4);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // samo za MacOS
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- GLFWwindow* window = glfwCreateWindow( 1024, 768, "prog", nullptr, nullptr);
- if( window == nullptr )
- {
- std::cerr << "Nije proΕ‘ao init glfw prozora. Npr. neki Intel GPU nisu 3.3 kompatibilni.\n";
- getchar();
- glfwTerminate();
- return -1;
- }
- glfwMakeContextCurrent(window);
- if (glewInit() != GLEW_OK)
- {
- std::cerr << "GLEW nije inicijaliziran\n";
- getchar();
- glfwTerminate();
- return -1;
- }
- glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
- glClearColor(0.9f, 0.9f, 0.9f, 0.0f);
- GLuint programID = loadShaders($1);
- do {
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glUseProgram(programID);
- glfwSwapBuffers(window);
- glfwPollEvents();
- }
- while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
- glfwWindowShouldClose(window) == 0 );
- glfwTerminate();
- return 0;
- }]]></content>
- <tabTrigger>gl</tabTrigger>
- </snippet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement