#print buf print np.dot( np.dot(camera.T_proj_view(), camera.T_view_world()) , np.array([[0],[0],[-1],[1]]) ) A = np.empty(16*3, np.float32) glGetNamedBufferSubData(sceneUBO, 0, A.nbytes, A) for i in range(3): print A[16*i:16*i+16].reshape((4,4)).transpose() while not glfw.WindowShouldClose(window): glfw.PollEvents() t = glfw.GetTime() update_fps_counter(window) tex.update(raw_im) #sceneData = packSceneData() #glNamedBufferSubData(sceneUBO, 0, sceneData.nbytes, sceneData) objectData = packObjectData() glNamedBufferSubData(objectUBO, 0, objectData.nbytes, objectData) glBindFramebuffer(GL_FRAMEBUFFER, fbo) glViewport(0,0,framebuf_width,framebuf_height) glClearColor(0.0,0.0,0.0,0.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_DEPTH_TEST) color_shader.use() glDrawArrays(GL_POINTS, 0, 1) glBindFramebuffer(GL_FRAMEBUFFER, 0)
GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT) glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 1, objectUBO[0], 0, objectData.nbytes) while not glfw.WindowShouldClose(window.windowID): glfw.PollEvents() t = glfw.GetTime() sceneData = packSceneData() glNamedBufferSubData(sceneUBO, 0, sceneData.nbytes, sceneData) objectData = packObjectData() glNamedBufferSubData(objectUBO, 0, objectData.nbytes, objectData) window.update_fps_counter() tex.update(webcam_image) glViewport(0, 0, window.framebuf_width, window.framebuf_height) glClearColor(0.0, 0.0, 0.0, 1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) screen_shader.use() glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) color_shader.use() quad_shader.use() T = np.dot(np.dot(camera.T_proj_world(), T_world_prime), T_world_board) glUniformMatrix4fv(0, 1, GL_TRUE, T) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glUniform4fv(1, 1, np.array([0.3, 0.4, 0.7, 0.4], dtype=np.float32)) glDrawArrays(GL_TRIANGLE_FAN, 0, 4)