File diff r24894:d604b22f3659 → r24895:0ba728d1a5e0
src/video/opengl.h
Show inline comments
 
@@ -11,12 +11,13 @@
 

	
 
#ifndef VIDEO_OPENGL_H
 
#define VIDEO_OPENGL_H
 

	
 
#include "../core/alloc_type.hpp"
 
#include "../core/geometry_type.hpp"
 
#include "../gfx_type.h"
 

	
 
typedef void (*OGLProc)();
 
typedef OGLProc (*GetOGLProcAddressProc)(const char *proc);
 

	
 
bool IsOpenGLVersionAtLeast(byte major, byte minor);
 
const char *FindStringInExtensionList(const char *string, const char *substring);
 
@@ -25,15 +26,17 @@ const char *FindStringInExtensionList(co
 
class OpenGLBackend : public ZeroedMemoryAllocator {
 
private:
 
	static OpenGLBackend *instance; ///< Singleton instance pointer.
 

	
 
	GLuint vid_pbo;     ///< Pixel buffer object storing the memory used for the video driver to draw to.
 
	GLuint vid_texture; ///< Texture handle for the video buffer texture.
 
	GLuint vid_program; ///< Shader program for rendering the video buffer.
 
	GLuint vid_program; ///< Shader program for rendering a RGBA video buffer.
 
	GLuint pal_program; ///< Shader program for rendering a paletted video buffer.
 
	GLuint vao_quad;    ///< Vertex array object storing the rendering state for the fullscreen quad.
 
	GLuint vbo_quad;    ///< Vertex buffer with a fullscreen quad.
 
	GLuint pal_texture; ///< Palette lookup texture.
 

	
 
	OpenGLBackend();
 
	~OpenGLBackend();
 

	
 
	const char *Init();
 
	bool InitShaders();
 
@@ -44,12 +47,13 @@ public:
 
	{
 
		return OpenGLBackend::instance;
 
	}
 
	static const char *Create(GetOGLProcAddressProc get_proc);
 
	static void Destroy();
 

	
 
	void UpdatePalette(const Colour *pal, uint first, uint length);
 
	bool Resize(int w, int h, bool force = false);
 
	void Paint();
 

	
 
	void *GetVideoBuffer();
 
	void ReleaseVideoBuffer(const Rect &update_rect);
 
};