if not window: glfw.terminate() glfw.set_window_should_close(window, True) glfw.make_context_current(window) # Connecting the callback function 'on_key' to handle keyboard events glfw.set_key_callback(window, on_key) # Binding artificial vertex array object for validation VAO = glGenVertexArrays(1) glBindVertexArray(VAO) # Creating shader programs mvpPipeline = es.SimpleModelViewProjectionShaderProgram() texture2dPipeline = es.SimpleTextureTransformShaderProgram() # Setting up the clear screen color glClearColor(0.25, 0.25, 0.25, 1.0) # As we work in 3D, we need to check which part is in front, # and which one is at the back glEnable(GL_DEPTH_TEST) # Enabling transparencies glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # Creating shapes on GPU memory cpuAxis = bs.createAxis(7)
# now actually attach it glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo) # now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now if glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE: print("ERROR::FRAMEBUFFER:: Framebuffer is not complete!") # Binding again the default shape buffer glBindFramebuffer(GL_FRAMEBUFFER, 0) # Creating shader programs for textures and for colors ####################### textureShaderProgram = es.SimpleTextureTransformShaderProgram() colorShaderProgram = es.SimpleModelViewProjectionShaderProgram() # Creating shapes on GPU memory ####################### rainbowCube = bs.createRainbowCube() gpuRainbowCube = es.GPUShape().initBuffers() colorShaderProgram.setupVAO(gpuRainbowCube) gpuRainbowCube.fillBuffers(rainbowCube.vertices, rainbowCube.indices, GL_STATIC_DRAW) shapeQuad = bs.createTextureQuad(1, 1) gpuQuad = es.GPUShape().initBuffers() textureShaderProgram.setupVAO(gpuQuad) gpuQuad.fillBuffers(shapeQuad.vertices, shapeQuad.indices, GL_STATIC_DRAW) gpuQuad.texture = textureColorbuffer # <--- Here is where the magic happens!