Use Qt's resource system to store the shader source
The shader source is included inside each comipled binary file. The OpenGL example also provides its own shader files which overrides the default. Common shader code is in the 'common' directory and each example's custom shader is alongside the example's C++ code.
This commit is contained in:
@ -49,17 +49,18 @@ FIND_PACKAGE(OpenGL REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR})
|
||||
LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR})
|
||||
|
||||
#This will include the shader files inside the compiled binary
|
||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||
QT4_ADD_RESOURCES(OPENGLEXAMPLE_RESOURCES_RCC openglexample.qrc)
|
||||
|
||||
#Build
|
||||
ADD_EXECUTABLE(OpenGLExample ${SRC_FILES})
|
||||
ADD_EXECUTABLE(OpenGLExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${OPENGLEXAMPLE_RESOURCES_RCC})
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||
ENDIF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(OpenGLExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore)
|
||||
SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples")
|
||||
|
||||
configure_file(../common/example.vert example.vert COPYONLY)
|
||||
configure_file(../common/example.frag example.frag COPYONLY)
|
||||
|
||||
#Install - Only install the example in Windows
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS OpenGLExample
|
||||
|
Reference in New Issue
Block a user