00001 #ifndef OGL_GL_WRAPPER_H
00002 #define OGL_GL_WRAPPER_H
00003
00004 #ifdef USE_TILE
00005 #ifdef USE_GL
00006
00007 #include "glwrapper.h"
00008
00009 class OGLStateManager : public GLStateManager
00010 {
00011 public:
00012 OGLStateManager();
00013
00014
00015 virtual void set(const GLState& state);
00016 virtual void pixelstore_unpack_alignment(unsigned int bpp);
00017 virtual void reset_view_for_redraw(float x, float y);
00018 virtual void reset_view_for_resize(const coord_def &m_windowsz);
00019 virtual void set_transform(const GLW_3VF &trans, const GLW_3VF &scale);
00020 virtual void reset_transform();
00021
00022
00023 virtual void delete_textures(size_t count, unsigned int *textures);
00024 virtual void generate_textures(size_t count, unsigned int *textures);
00025 virtual void bind_texture(unsigned int texture);
00026 virtual void load_texture(unsigned char *pixels, unsigned int width,
00027 unsigned int height, MipMapOptions mip_opt);
00028 protected:
00029 GLState m_current_state;
00030 };
00031
00032 class OGLShapeBuffer : public GLShapeBuffer
00033 {
00034 public:
00035 OGLShapeBuffer(bool texture = false, bool colour = false,
00036 drawing_modes prim = GLW_RECTANGLE);
00037
00038 virtual const char *print_statistics() const;
00039 virtual unsigned int size() const;
00040
00041 virtual void add(const GLWPrim &rect);
00042 virtual void draw(const GLState &state);
00043 virtual void clear();
00044
00045 protected:
00046
00047 void add_rect(const GLWPrim &rect);
00048 void add_line(const GLWPrim &rect);
00049
00050 drawing_modes m_prim_type;
00051 bool m_texture_verts;
00052 bool m_colour_verts;
00053
00054 std::vector<GLW_3VF> m_position_buffer;
00055 std::vector<GLW_2VF> m_texture_buffer;
00056 std::vector<VColour> m_colour_buffer;
00057 std::vector<unsigned short int> m_ind_buffer;
00058 };
00059
00060 #endif // USE_GL
00061 #endif // USE_TILE
00062 #endif // OGL_GL_WRAPPER_H