From 04cefb857e2738c103b81f8ac1502f344d84c16f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Jul 2010 00:06:08 +0300 Subject: Improve OpenGL speed. Use batch commands and not selecting already selected texture. Signed-off-by: Jared Adams --- src/openglgraphics.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/openglgraphics.h') diff --git a/src/openglgraphics.h b/src/openglgraphics.h index 03738bfb..ee96e19c 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -22,8 +22,16 @@ #ifndef OPENGLGRAPHICS_H #define OPENGLGRAPHICS_H +#include "main.h" + #include "graphics.h" +#ifdef USE_OPENGL +#define NO_SDL_GLEXT + +#include +#endif + class OpenGLGraphics : public Graphics { public: @@ -72,8 +80,8 @@ class OpenGLGraphics : public Graphics * Draw a pattern based on a rescaled version of the given image... */ void drawRescaledImagePattern(Image *image, - int x, int y, int w, int h, - int scaledWidth, int scaledHeight); + int x, int y, int w, int h, + int scaledWidth, int scaledHeight); void updateScreen(); @@ -97,15 +105,26 @@ class OpenGLGraphics : public Graphics void setTargetPlane(int width, int height); + void drawQuadArrayfi(int size); + + void drawQuadArrayii(int size); + /** * Takes a screenshot and returns it as SDL surface. */ SDL_Surface *getScreenshot(); + static void bindTexture(GLenum target, GLuint texture); + + static GLuint mLastImage; + protected: void setTexturingAndBlending(bool enable); private: + GLfloat *mFloatTexArray; + GLint *mIntTexArray; + GLint *mIntVertArray; bool mAlpha, mTexture; bool mColorAlpha; bool mSync; -- cgit v1.2.3-60-g2f50