converted shaders to glsl extension
This commit is contained in:
parent
97032c2fe6
commit
144daa8c3c
@ -42,7 +42,7 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|||||||
set(CPP_DEFINES -DRENDER_DEBUG)
|
set(CPP_DEFINES -DRENDER_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB LIBRARY_RES_FILES *.h *.frag *.vert)
|
file(GLOB LIBRARY_RES_FILES *.h *.glsl)
|
||||||
|
|
||||||
add_library(${LIBRARY_NAME} STATIC ${LIB_SRC_LIST} ${LIBRARY_RES_FILES})
|
add_library(${LIBRARY_NAME} STATIC ${LIB_SRC_LIST} ${LIBRARY_RES_FILES})
|
||||||
add_definitions(-std=c++11 ${CPP_DEFINES})
|
add_definitions(-std=c++11 ${CPP_DEFINES})
|
||||||
|
@ -49,7 +49,6 @@ vec3 phongLighting(in vec3 kd, in vec3 ks, in float ns, in vec3 color, in vec3 n
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
#ifdef
|
|
||||||
#ifdef ALPHA_MASK
|
#ifdef ALPHA_MASK
|
||||||
if(texture(alphaMask, varTexCoord).r < 0.5)
|
if(texture(alphaMask, varTexCoord).r < 0.5)
|
||||||
discard;
|
discard;
|
||||||
@ -80,9 +79,9 @@ void main(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AMBIENT_LIGHT
|
#ifdef AMBIENT_LIGHT
|
||||||
outColor = vec4(lightColor*ambient, 1);
|
outColor = vec4(diffuse, 1);
|
||||||
#else
|
#else
|
||||||
vec3 light = phongLighting(diffuse, specular, materialNs, lightColor, normal, lightDirInView, halfVecInView);
|
vec3 light = phongLighting(diffuse, specular, materialNs, lightColor, normal, lightDirInView, halfVecInView);
|
||||||
outColor = vec4(light, 1);
|
outColor = vec4(light, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
@ -36,6 +36,8 @@ void SparrowRenderer::initGL(int width, int height, bool forceCrappy)
|
|||||||
|
|
||||||
std::cout << "OpenGL version " << glGetString(GL_VERSION) << std::endl;
|
std::cout << "OpenGL version " << glGetString(GL_VERSION) << std::endl;
|
||||||
std::cout << "GLSL version " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
std::cout << "GLSL version " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||||
|
std::cout << "gl renderer " << glGetString(GL_RENDERER) << std::endl;
|
||||||
|
std::cout << "gl vendor " << glGetString(GL_VENDOR) << std::endl;
|
||||||
|
|
||||||
glAssert(glEnable(GL_DEPTH_TEST));
|
glAssert(glEnable(GL_DEPTH_TEST));
|
||||||
glAssert(glEnable(GL_CULL_FACE));
|
glAssert(glEnable(GL_CULL_FACE));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user