Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/particles/ParticleRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 6 additions & 7 deletions src/scenes/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down