aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llglimmediate.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llrender/llglimmediate.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/linden/indra/llrender/llglimmediate.h b/linden/indra/llrender/llglimmediate.h
new file mode 100644
index 0000000..bf2f9ab
--- /dev/null
+++ b/linden/indra/llrender/llglimmediate.h
@@ -0,0 +1,104 @@
1/**
2 * @file llglimmediate.h
3 * @brief LLGLImmediate definition
4 *
5 * This class acts as a wrapper for OpenGL immediate calls concerning glBegin and glEnd.
6 * The goal of this class is to minimize the number of api calls due to legacy rendering
7 * code, and to define an interface for a multiple rendering API abstraction of the UI
8 * rendering.
9 *
10 * $LicenseInfo:firstyear=2001&license=viewergpl$
11 *
12 * Copyright (c) 2001-2008, Linden Research, Inc.
13 *
14 * Second Life Viewer Source Code
15 * The source code in this file ("Source Code") is provided by Linden Lab
16 * to you under the terms of the GNU General Public License, version 2.0
17 * ("GPL"), unless you have obtained a separate licensing agreement
18 * ("Other License"), formally executed by you and Linden Lab. Terms of
19 * the GPL can be found in doc/GPL-license.txt in this distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
21 *
22 * There are special exceptions to the terms and conditions of the GPL as
23 * it is applied to this Source Code. View the full text of the exception
24 * in the file doc/FLOSS-exception.txt in this software distribution, or
25 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
26 *
27 * By copying, modifying or distributing this software, you acknowledge
28 * that you have read and understood your obligations described above,
29 * and agree to abide by those obligations.
30 *
31 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
32 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
33 * COMPLETENESS OR PERFORMANCE.
34 * $/LicenseInfo$
35 */
36
37#ifndef LL_LLGLIMMEDIATE_H
38#define LL_LLGLIMMEDIATE_H
39
40#include "stdtypes.h"
41#include "llgltypes.h"
42#include "llglheaders.h"
43
44class LLGLImmediate
45{
46public:
47 LLGLImmediate();
48
49 void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
50 void pushMatrix();
51 void popMatrix();
52 void blendFunc(GLenum sfactor, GLenum dfactor);
53 void start();
54 void stop();
55 void flush();
56
57 void begin(const GLuint& mode);
58 void end();
59 void vertex2i(const GLint& x, const GLint& y);
60 void vertex2f(const GLfloat& x, const GLfloat& y);
61 void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z);
62 void vertex2fv(const GLfloat* v);
63 void vertex3fv(const GLfloat* v);
64
65 void texCoord2i(const GLint& x, const GLint& y);
66 void texCoord2f(const GLfloat& x, const GLfloat& y);
67 void texCoord2fv(const GLfloat* tc);
68
69 void color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a);
70 void color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a);
71 void color4fv(const GLfloat* c);
72 void color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b);
73 void color3fv(const GLfloat* c);
74 void color4ubv(const GLubyte* c);
75
76 // switch clever mode GL immediate rendering on or off. Setting to true builds
77 // client arrays manually, setting to false passes through the GL immediate mode
78 // commands to the GL implementation. Controllable by the RenderUseCleverUI
79 // debug setting.
80 // *NOTE: I have measured that this has about a 9% performance cost (0.6ms) for the
81 // Render/UI fasttimer vs the old #if CLEVER compile time switch. Dave Parks and I
82 // agreed that this was acceptable at the time due to it enabling better regression
83 // testing for QA.
84 // -Brad
85 void setClever(bool do_clever);
86
87 typedef struct Vertex
88 {
89 GLfloat v[3];
90 GLubyte c[4];
91 GLfloat uv[2];
92 };
93
94private:
95 static bool sClever;
96
97 U32 mCount;
98 U32 mMode;
99 Vertex mBuffer[4096];
100};
101
102extern LLGLImmediate gGL;
103
104#endif