| Trees | Indices | Help |
|---|
|
|
1 """Query classes.
2
3 @warning: The C{Query} class is currently untested.
4
5 @author: Stephan Wenger
6 @date: 2012-02-29
7 """
8
9 import glitter.raw as _gl
10 from glitter.utils import ManagedObject, BindReleaseObject
13 _generate_id = _gl.glGenQueries
14 _delete_id = _gl.glDeleteQueries
15 _db = "queries"
16
18 if any(x is NotImplemented for x in (self._target,)):
19 raise TypeError("%s is abstract" % self.__class__.__name__)
20 super(Query, self).__init__(context=context)
21 if self._counter_bits == 0:
22 raise RuntimeError("%s not supported" % self.__class__.__name__)
23
25 _gl.glBeginQuery(self._id)
26
28 _gl.glEndQuery()
29
30 @property
32 _current_query = _gl.GLint()
33 _gl.glGetQueryiv(self._target, _gl.GL_CURRENT_QUERY, _gl.pointer(_current_query))
34 return _current_query.value
35
36 @property
38 _counter_bits = _gl.GLint()
39 _gl.glGetQueryiv(self._target, _gl.GL_QUERY_COUNTER_BITS, _gl.pointer(_counter_bits))
40 return _counter_bits.value
41
42 @property
44 _result_available = _gl.GLint()
45 _gl.glGetQueryObjectiv(self._id, _gl.GL_QUERY_RESULT_AVAILABLE, _gl.pointer(_result_available))
46 return bool(_result_available.value)
47
48 @property
50 if self._counter_bits <= 32:
51 _result = _gl.GLuint()
52 _gl.glGetQueryObjectuiv(self._id, _gl.GL_QUERY_RESULT_AVAILABLE, _gl.pointer(_result))
53 else:
54 _result = _gl.GLuint64()
55 _gl.glGetQueryObjectui64v(self._id, _gl.GL_QUERY_RESULT_AVAILABLE, _gl.pointer(_result))
56 return _result.value
57
59 """@todo: Wrap C{glBeginConditionalRender} and C{glEndConditionalRender}."""
60 _target = _gl.GL_SAMPLES_PASSED
61
63 """@todo: Wrap C{glBeginConditionalRender} and C{glEndConditionalRender}."""
64 _target = _gl.GL_ANY_SAMPLES_PASSED
65 result = property(lambda self: bool(Query.result.fget(self)))
66
69
72
75
76 __all__ = [
77 "Query",
78 "SamplesPassedQuery",
79 "AnySamplesPassedQuery",
80 "PrimitivesGeneratedQuery",
81 "TransformFeedbackPrimitivesWrittenQuery",
82 "TimeElapsedQuery",
83 ]
84
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Fri Mar 16 17:56:05 2012 | http://epydoc.sourceforge.net |