aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llgl.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llwindow/llgl.h
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llwindow/llgl.h')
-rw-r--r--linden/indra/llwindow/llgl.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/linden/indra/llwindow/llgl.h b/linden/indra/llwindow/llgl.h
index 57bd616..25ad0d6 100644
--- a/linden/indra/llwindow/llgl.h
+++ b/linden/indra/llwindow/llgl.h
@@ -42,8 +42,12 @@
42#include "llstring.h" 42#include "llstring.h"
43#include "stdtypes.h" 43#include "stdtypes.h"
44#include "v4math.h" 44#include "v4math.h"
45#include "llplane.h"
45#include "llgltypes.h" 46#include "llgltypes.h"
46 47
48#include "llglheaders.h"
49#include "glh/glh_linear.h"
50
47#define LL_DEBUG_GL 1 51#define LL_DEBUG_GL 1
48 52
49#define LL_GL_ERRS llerrs 53#define LL_GL_ERRS llerrs
@@ -97,6 +101,9 @@ public:
97 BOOL mIsGFFX; 101 BOOL mIsGFFX;
98 BOOL mATIOffsetVerticalLines; 102 BOOL mATIOffsetVerticalLines;
99 103
104 // Whether this version of GL is good enough for SL to use
105 BOOL mHasRequirements;
106
100#if LL_WINDOWS 107#if LL_WINDOWS
101 BOOL mHasWGLARBPixelFormat; 108 BOOL mHasWGLARBPixelFormat;
102#endif // LL_WINDOWS 109#endif // LL_WINDOWS
@@ -257,6 +264,94 @@ public:
257 LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {} 264 LLGLDisable(LLGLenum state) : LLGLState(state, FALSE) {}
258}; 265};
259 266
267/*
268 Store and modify projection matrix to create an oblique
269 projection that clips to the specified plane. Oblique
270 projections alter values in the depth buffer, so this
271 class should not be used mid-renderpass.
272
273 Restores projection matrix on destruction.
274 GL_MODELVIEW_MATRIX is active whenever program execution
275 leaves this class.
276 Does not stack.
277 Caches inverse of projection matrix used in gGLObliqueProjectionInverse
278*/
279class LLGLUserClipPlane
280{
281public:
282
283 LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection);
284 ~LLGLUserClipPlane();
285
286 void setPlane(F32 a, F32 b, F32 c, F32 d);
287
288private:
289 glh::matrix4f mProjection;
290 glh::matrix4f mModelview;
291};
292
293/*
294 Modify and load projection matrix to push depth values to far clip plane.
295
296 Restores projection matrix on destruction.
297 GL_MODELVIEW_MATRIX is active whenever program execution
298 leaves this class.
299 Does not stack.
300*/
301class LLGLClampToFarClip
302{
303public:
304 LLGLClampToFarClip(glh::matrix4f projection);
305 ~LLGLClampToFarClip();
306};
307
308/*
309 Generic pooling scheme for things which use GL names (used for occlusion queries and vertex buffer objects).
310 Prevents thrashing of GL name caches by avoiding calls to glGenFoo and glDeleteFoo.
311*/
312class LLGLNamePool
313{
314public:
315 typedef struct
316 {
317 GLuint name;
318 BOOL used;
319 } NameEntry;
320
321 struct CompareUsed
322 {
323 bool operator()(const NameEntry& lhs, const NameEntry& rhs)
324 {
325 return lhs.used < rhs.used; //FALSE entries first
326 }
327 };
328
329 typedef std::vector<NameEntry> name_list_t;
330 name_list_t mNameList;
331
332 LLGLNamePool();
333 virtual ~LLGLNamePool();
334
335 void upkeep();
336 void cleanup();
337
338 GLuint allocate();
339 void release(GLuint name);
340
341 static void registerPool(LLGLNamePool* pool);
342 static void upkeepPools();
343 static void cleanupPools();
344
345protected:
346 typedef std::vector<LLGLNamePool*> pool_list_t;
347 static pool_list_t sInstances;
348
349 virtual GLuint allocateName() = 0;
350 virtual void releaseName(GLuint name) = 0;
351};
352
353extern LLMatrix4 gGLObliqueProjectionInverse;
354
260#include "llglstates.h" 355#include "llglstates.h"
261 356
262void init_glstates(); 357void init_glstates();