Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define GLEW_STATIC
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include <gl/wglew.h>
- #include "freeimage/freeimage.h"
- //#include "opengl_framework.h"
- #include <fstream>
- #include <vector>
- using namespace std;
- bool makelog(char *message)
- {
- ofstream fout("log.txt");
- fout << message << endl;
- fout.close();
- return true;
- }
- bool writelog(char *message)
- {
- ofstream fout("log.txt", ios_base::app);
- fout << message << endl;
- //fout.close();
- return true;
- }
- // ***************************************************************************************************************************
- // ***************************************************************************************************************************
- void error_callback(int, const char* description)
- {
- std::cerr << description << std::endl;
- }
- int main(int, char const* [])
- {
- makelog(">");
- std::cerr << "Initializing OpenGL." << std::endl;
- writelog("Initializing OpenGL.");
- glfwInit();
- glfwSetErrorCallback(error_callback);
- glfwWindowHint(GLFW_DECORATED, GL_TRUE);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- auto window = glfwCreateWindow(640, 480, "MaSzyna Client", nullptr, nullptr);
- glfwMakeContextCurrent(window);
- glewExperimental = true;
- if(GLenum err = glewInit() != GLEW_OK)
- {
- writelog("glewInit Failed!");
- std::cerr << glewGetErrorString(err) << std::endl;
- return EXIT_FAILURE;
- }
- if (!GLEW_VERSION_3_2)
- {
- writelog("OpenGL 3.2 not supported!");
- return false;
- }
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- if (GLEW_ARB_texture_non_power_of_two == NULL)
- {
- writelog("GLEW_ARB_texture_non_power_of_two not supported!");
- }
- else
- {
- writelog("GLEW_ARB_texture_non_power_of_twoy OK");
- }
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- if (glMultiDrawIndirect == nullptr)
- {
- writelog("glMultiDrawIndirect not supported!");
- }
- else
- {
- writelog("glMultiDrawIndirect OK");
- }
- writelog("OGLR->Init()");
- //OGLR->Init();
- writelog("MAIN LOOP");
- while(!glfwWindowShouldClose(window))
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glfwSwapBuffers(window);
- glfwPollEvents();
- }
- glfwDestroyWindow(window);
- glfwTerminate();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement