예제 #1
0
	def draw_direct_advanced(self, mode):
		if not self.mesh_quad_count:
			return

		gl.glBindVertexArray(self.vao)
		gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2])

		gl.glBeginQuery(gl.GL_ANY_SAMPLES_PASSED, self.occlusion_query)
		gl.glDrawElements(
			mode,
			self.mesh_quad_count * 6,
			gl.GL_UNSIGNED_INT,
			None,
		)
		gl.glEndQuery(gl.GL_ANY_SAMPLES_PASSED)

		
		gl.glBeginConditionalRender(self.occlusion_query, gl.GL_QUERY_BY_REGION_WAIT)
		gl.glDrawElements(
			mode,
			self.mesh_quad_count * 6,
			gl.GL_UNSIGNED_INT,
			None,
		)
		gl.glEndConditionalRender()
예제 #2
0
 def __enter__(self):
     gl.glBeginQuery(gl.GL_SAMPLES_PASSED, self._glo_samples_passed)
     gl.glBeginQuery(gl.GL_TIME_ELAPSED, self._glo_time_elapsed)
     gl.glBeginQuery(gl.GL_PRIMITIVES_GENERATED,
                     self._glo_primitives_generated)