16 #include <SDL_opengl.h>
25 extern PFNGLCREATEPROGRAMPROC glCreateProgram;
26 extern PFNGLUSEPROGRAMPROC glUseProgram;
27 extern PFNGLCREATESHADERPROC glCreateShader;
28 extern PFNGLDELETESHADERPROC glDeleteShader;
29 extern PFNGLSHADERSOURCEPROC glShaderSource;
30 extern PFNGLCOMPILESHADERPROC glCompileShader;
31 extern PFNGLATTACHSHADERPROC glAttachShader;
32 extern PFNGLDETACHSHADERPROC glDetachShader;
33 extern PFNGLLINKPROGRAMPROC glLinkProgram;
34 extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
35 extern PFNGLUNIFORM1IPROC glUniform1i;
36 extern PFNGLUNIFORM2FVPROC glUniform2fv;
37 extern PFNGLUNIFORM4FVPROC glUniform4fv;
40 std::string strGLError(GLenum glErr);
42 #define glErrorCheck() {\
43 static bool reported = false;\
45 if (OpenGL::checkErrors && !reported && (glErr = glGetError()) != GL_NO_ERROR)\
51 Log(LOG_WARNING) << __FILE__ << ":" << __LINE__ << ": glGetError() complaint: " << strGLError(glErr);\
52 } while (((glErr = glGetError()) != GL_NO_ERROR));\
61 GLuint fragmentshader;
68 unsigned iwidth, iheight, iformat, ibpp;
70 static bool checkErrors;
73 void resize(
unsigned width,
unsigned height);
75 bool lock(uint32_t *&data,
unsigned &pitch);
79 void refresh(
bool smooth,
unsigned inwidth,
unsigned inheight,
unsigned outwidth,
unsigned outheight,
int topBlackBand,
int bottomBlackBand,
int leftBlackBand,
int rightBlackBand);
87 void init(
int width,
int height);
101 namespace OpenXcom {
class OpenGL {}; }
void set_vertex_shader(const char *source)
and vertex?
Definition: OpenGL.cpp:257
void set_fragment_shader(const char *source)
same but for fragment shader?
Definition: OpenGL.cpp:250
OpenGL()
constructor – like we said, we're too cool to actually construct things
Definition: OpenGL.cpp:345
void resize(unsigned width, unsigned height)
call to resize internal buffer; internal use
Definition: OpenGL.cpp:104
void init(int width, int height)
init(), because we're too cool to initialize everything in the constructor
Definition: OpenGL.cpp:264
void term()
more like exit, because destructors are for uncool people
Definition: OpenGL.cpp:330
bool lock(uint32_t *&data, unsigned &pitch)
actually returns pointer to data buffer where one is to write the image
Definition: OpenGL.cpp:126
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void setVSync(bool sync)
Try to set VSync!
Definition: OpenGL.cpp:311
void set_shader(const char *source)
set a shader! but what kind?
Definition: OpenGL.cpp:214
void clear()
make all the pixels go away
Definition: OpenGL.cpp:131
void refresh(bool smooth, unsigned inwidth, unsigned inheight, unsigned outwidth, unsigned outheight, int topBlackBand, int bottomBlackBand, int leftBlackBand, int rightBlackBand)
make the buffer show up on screen
Definition: OpenGL.cpp:139