直接移除blending部分
This commit is contained in:
parent
37765e7cab
commit
ad74332190
|
@ -21,10 +21,6 @@ add_subdirectory(./deps/glm)
|
||||||
##test target##
|
##test target##
|
||||||
add_executable(jungle ./test/main.cpp ./deps/glad/src/glad.c)
|
add_executable(jungle ./test/main.cpp ./deps/glad/src/glad.c)
|
||||||
target_include_directories(jungle PRIVATE ./test/)
|
target_include_directories(jungle PRIVATE ./test/)
|
||||||
if (${BLENDING})
|
|
||||||
add_definitions(-DBLENDING=1)
|
|
||||||
message("开启BLENDING")
|
|
||||||
endif()
|
|
||||||
#glfw dep
|
#glfw dep
|
||||||
add_dependencies(jungle glfw)
|
add_dependencies(jungle glfw)
|
||||||
target_include_directories(jungle PRIVATE ./deps/glfw/include/ ./deps/glad/include/ ./inc)
|
target_include_directories(jungle PRIVATE ./deps/glfw/include/ ./deps/glad/include/ ./inc)
|
||||||
|
|
|
@ -73,9 +73,6 @@ int main()
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
|
||||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
||||||
#ifdef BLENDING
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
@ -115,10 +112,6 @@ int main()
|
||||||
|
|
||||||
// configure global opengl state
|
// configure global opengl state
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
#ifdef BLENDING
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
|
|
||||||
#endif
|
|
||||||
// glEnable(GL_DEPTH_TEST);
|
// glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
// build and compile our shader zprogram
|
// build and compile our shader zprogram
|
||||||
|
@ -342,21 +335,6 @@ int main()
|
||||||
// glDepthMask(GL_FALSE);
|
// glDepthMask(GL_FALSE);
|
||||||
|
|
||||||
// render transparent objects with blending enabled
|
// render transparent objects with blending enabled
|
||||||
#ifdef BLENDING
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
for (unsigned int i = 5; i < 10; i++)
|
|
||||||
{
|
|
||||||
ourShader.setIVec2("index", cubeTextures[i]);
|
|
||||||
|
|
||||||
// calculate the model matrix for each object and pass it to shader before drawing
|
|
||||||
glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first
|
|
||||||
model = glm::translate(model, glm::vec3(cubePositions[i]));
|
|
||||||
ourShader.setMat4("model", model);
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
|
||||||
}
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// glDisable(GL_DEPTH_TEST);
|
// glDisable(GL_DEPTH_TEST);
|
||||||
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
||||||
|
|
Loading…
Reference in New Issue