Skip to content

Commit

Permalink
Add GLEW and move to OpenGL4
Browse files Browse the repository at this point in the history
  • Loading branch information
Anne Marije v/d Meer committed Nov 12, 2018
1 parent a4cd560 commit 75ea254
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ set_package_properties(string_theory PROPERTIES
)
include_directories(${STRING_THEORY_INCLUDE_DIRS})

find_package(GLEW REQUIRED)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
include_directories(${GLEW_INCLUDE_DIR})
include_directories(${OPENGL_INCLUDE_DIR})
Expand Down
18 changes: 18 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static void openglCallbackFunction(
}

ST::string s_rootPath;

imVfs s_vfs;
SDL_Window *s_display;

Expand Down Expand Up @@ -261,6 +262,21 @@ int main(int argc, char *argv[])
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glewExperimental = true;
if (glewInit() != GLEW_OK) {
fprintf(stderr, "Failed to initialize GLEW\n");
return -1;
}
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(openglCallbackFunction, nullptr);
glDebugMessageControl(
GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true
);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

GLX_CompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)
SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
if (GLX_CompressedTexImage2D == 0)
Expand All @@ -280,6 +296,8 @@ int main(int argc, char *argv[])
img.prepare();
pipeline.initialize();

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0.0f, 0.0f, -4.0f);
img.bind();
pipeline.render();

Expand Down

0 comments on commit 75ea254

Please sign in to comment.