summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/glwrapper.h
diff options
context:
space:
mode:
authorIxtli <cg@325i.org>2010-04-26 20:13:41 +0900
committerEnne Walker <enne.walker@gmail.com>2010-05-14 18:18:51 -0400
commit371d8112277cbaff095280c797d8a565ac6fd84c (patch)
treea0470a33ff399888e8b7c93d1e1c99dc0e05a12e /crawl-ref/source/glwrapper.h
parent2458d5828e0a35e288d7b1c41d7f664a620cab77 (diff)
downloadcrawl-ref-371d8112277cbaff095280c797d8a565ac6fd84c.tar.gz
crawl-ref-371d8112277cbaff095280c797d8a565ac6fd84c.zip
Added GLShapeBuffer. Changed GLState, Manager.
Added convenience methods to GLState. Changed GLStateManager to check current state before using glEnable in case those commands are slow, as they are being called nearly ever draw. (Note: GLShapeBuffer is not currently used.) Signed-off-by: Enne Walker <enne.walker@gmail.com>
Diffstat (limited to 'crawl-ref/source/glwrapper.h')
-rw-r--r--crawl-ref/source/glwrapper.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/glwrapper.h b/crawl-ref/source/glwrapper.h
index 5b8b29fef4..2a93cc1c47 100644
--- a/crawl-ref/source/glwrapper.h
+++ b/crawl-ref/source/glwrapper.h
@@ -199,6 +199,10 @@ struct GLPrimitive
struct GLState
{
GLState();
+ GLState(const GLState &state);
+
+ // convenience methods
+ void set(const GLState &state);
// vertex arrays
bool array_vertex;
@@ -229,6 +233,7 @@ public:
// State Manipulation
virtual void set(const GLState& state) = 0;
+ virtual const GLState& get_state() const = 0;
virtual void pixelstore_unpack_alignment(unsigned int bpp) = 0;
virtual void reset_view_for_redraw(float x, float y) = 0;
virtual void reset_view_for_resize(coord_def &m_windowsz) = 0;
@@ -254,6 +259,34 @@ public:
#endif
};
+class GenericTexture; // Defined in tiletex.h
+
+class GLShapeBuffer
+{
+public:
+ virtual ~GLShapeBuffer() {};
+
+ // Static Constructors
+ // Note: the init/shutdown static functions should be written in the derived
+ // implementation-specific cc file, e.g. glwrapper-ogl.cc.
+ static GLShapeBuffer *create(bool texture = false, bool colour = false,
+ drawing_modes prim = GLW_RECTANGLE);
+
+ // Accounting
+ virtual const char *print_statistics() const = 0;
+ virtual unsigned int size() const = 0;
+
+ // Add a rectangle or line
+ virtual void push(const GLWRect &rect) = 0;
+
+ // Draw the buffer
+ virtual void draw(GLW_3VF *pt = NULL, GLW_3VF *ps = NULL,
+ bool flush = false) = 0;
+
+ // Manipulate state
+ virtual void clear() = 0;
+};
+
// Main interface for GL functions
extern GLStateManager *glmanager;