GLEW for windows...;

This commit is contained in:
bjornbytes 2016-07-15 20:47:38 -07:00
parent 5615fe579c
commit f49cfa4f11
3 changed files with 20 additions and 2 deletions

View File

@ -4,8 +4,9 @@ project(lovr)
option(OSVR_PATH "The path to the osvr snapshot")
add_executable(lovr
src/util.c
src/glfw.c
src/util.c
src/shader.c
src/event.c
src/graphics.c
src/model.c
@ -28,10 +29,15 @@ add_subdirectory(deps/luajit luajit)
include_directories(deps/luajit/src ${CMAKE_BINARY_DIR}/luajit)
set(LOVR_LUA liblua)
# GLEW
add_subdirectory(deps/glew/build/cmake glew)
include_directories(deps/glew/include)
set(LOVR_GLEW glew)
# GLFW
add_subdirectory(deps/glfw glfw)
include_directories(deps/glfw/include)
set(LOVR_GLFW glfw opengl32 ${GLFW_LIBRARIES})
set(LOVR_GLFW glfw ${GLFW_LIBRARIES})
# assimp
add_subdirectory(deps/assimp assimp)
@ -50,6 +56,7 @@ move_dll(osvr::osvrClientKit)
set(LOVR_LIB
${LOVR_LUA}
${LOVR_GLEW}
${LOVR_GLFW}
${LOVR_ASSIMP}
)
@ -57,5 +64,6 @@ set(LOVR_LIB
target_link_libraries(lovr ${LOVR_LIB})
move_dll(${LOVR_LUA})
move_dll(${LOVR_GLEW})
move_dll(${LOVR_GLFW})
move_dll(${LOVR_ASSIMP})

View File

@ -24,4 +24,11 @@ void initGlfw(GLFWerrorfun onError, GLFWwindowclosefun onClose) {
glfwSetWindowCloseCallback(window, onClose);
glfwMakeContextCurrent(window);
GLenum err = glewInit();
if (err != GLEW_OK) {
error("Could not initialize GLEW");
} else if (!GLEW_VERSION_2_1) {
error("Geez your OpenGL is old");
}
}

View File

@ -1,6 +1,9 @@
#ifdef __APPLE__
#define GLFW_INCLUDE_GLCOREARB
#elif WIN32
#include <GL/glew.h>
#endif
#include <GLFW/glfw3.h>
GLFWwindow* window;