diff --git a/src/debug.cpp b/src/debug.cpp index 25b6c78..a3a9900 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -20,13 +20,15 @@ void printGLDiagnostics() namespace { -# if defined(_WIN32) -# define CALLBACK_ CALLBACK -# else // !win32 -# define CALLBACK_ -# endif // ~ platform - - GLvoid CALLBACK_ handle_debug_message_(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, GLchar const* message, GLvoid* /*user*/) + static void APIENTRY openglCallbackFunction( + GLenum source, + GLenum type, + GLuint id, + GLenum severity, + GLsizei length, + const GLchar* message, + const void* userParam + ) { // source string const char* srcStr = 0; @@ -95,13 +97,14 @@ void setupGLDebugMessages() { /* This causes a distinc performance loss but allows * the callback to be called immediately on error. */ + glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallback((GLDEBUGPROC)handle_debug_message_, 0); + glDebugMessageCallback(openglCallbackFunction, nullptr); glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, - 0, + NULL, true); } else diff --git a/src/main.cpp b/src/main.cpp index f0b7cb5..160a3df 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -98,14 +98,17 @@ void init() { if (!glfwInit()) exit(EXIT_FAILURE); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - window = glfwCreateWindow(WIDTH, HEIGHT, "IMP Engine", NULL, NULL); #if _DEBUG glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, true); #endif + window = glfwCreateWindow(WIDTH, HEIGHT, "IMP Engine", NULL, NULL); + + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); if (!window) { diff --git a/src/particles/ParticleRenderer.cpp b/src/particles/ParticleRenderer.cpp index effded1..b3ac43f 100644 --- a/src/particles/ParticleRenderer.cpp +++ b/src/particles/ParticleRenderer.cpp @@ -13,7 +13,7 @@ ParticleRenderer::~ParticleRenderer() void ParticleRenderer::init() { - glEnable(GL_POINT_SPRITE); + //glEnable(GL_POINT_SPRITE); /* If GL_PROGRAM_POINT_SIZE is enabled, then the point size comes from the output variable float gl_PointSize. diff --git a/src/scenes/Scene.cpp b/src/scenes/Scene.cpp index 9889be6..dce5c05 100644 --- a/src/scenes/Scene.cpp +++ b/src/scenes/Scene.cpp @@ -163,18 +163,17 @@ void Scene::render(glm::mat4 &viewMatrix, glm::mat4 &modelViewProjectionMatrix, glUniform3fv(glGetUniformLocation(shader, "lightPos"), 1, &lightPosition.x); // Draw cube - glDisable(GL_CULL_FACE); - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_LINE); glBindVertexArray(vao); - + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glDrawArrays(GL_TRIANGLES, 0, vertices.size()/3); - + glDisable(GL_CULL_FACE); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glDrawArrays(GL_TRIANGLES, 0, vertices.size() / 3); + glEnable(GL_CULL_FACE); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glBindVertexArray(0); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glEnable(GL_CULL_FACE); } void Scene::init()