add transparency for bubbles

This commit is contained in:
Thyme1 2022-01-08 22:35:24 +01:00
parent ce3acacbcf
commit c11c78114f

View File

@ -376,6 +376,9 @@ void renderScene()
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
glDrawArrays(GL_TRIANGLES, 0, 36);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glm::mat4 submarineInitialTransformation = glm::translate(glm::vec3(0, -0.5, -0.4)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.25f));
glm::mat4 submarineModelMatrix = glm::translate(cameraPos + cameraDir) * glm::mat4_cast(glm::inverse(rotation)) * submarineInitialTransformation;
@ -390,7 +393,7 @@ void renderScene()
glm::vec3 change0 = glm::vec3(0, 0, 0);
for (int j = 0; j < 50; j++) {
drawObjectTexture(bubbleContext, animationMatrix(time + j, change0, array[j], glm::vec3(0.1f), 0.99f), cubemapTexture, cubeProgram);
@ -412,7 +415,7 @@ void renderScene()
}
drawObjectTexture(submarineContext, submarineModelMatrix, textureSubmarine, programTexture);
glutSwapBuffers();
}