2018-06-13 19:15:16 +00:00
|
|
|
|
/*
|
2018-07-14 21:36:44 +00:00
|
|
|
|
* glsurface.h
|
2018-06-13 19:15:16 +00:00
|
|
|
|
* A 32-bit rendering surface that can quickly blit 8-bit paletted buffers implemented in OpenGL.
|
|
|
|
|
*
|
|
|
|
|
* Copyright <EFBFBD> 2018, Alex Dawson. All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef GLSURFACE_H_
|
|
|
|
|
#define GLSURFACE_H_
|
|
|
|
|
|
|
|
|
|
#include "compat.h"
|
|
|
|
|
|
|
|
|
|
// Initialize the glsurface with the Software renderer's buffer resolution.
|
|
|
|
|
// If the Software renderer's resolution and the actual resolution don't match,
|
|
|
|
|
// glsurface will still render at the full size of the screen.
|
|
|
|
|
// If a surface already exists, glsurface_destroy() will be automatically called before re-initializing.
|
|
|
|
|
// Returns whether or not the glsurface could be successfully initialized.
|
2018-07-14 21:36:44 +00:00
|
|
|
|
bool glsurface_initialize(vec2_t bufferResolution);
|
2018-06-13 19:15:16 +00:00
|
|
|
|
|
|
|
|
|
// Destroy an existing surface.
|
|
|
|
|
void glsurface_destroy();
|
|
|
|
|
|
2018-06-25 14:53:46 +00:00
|
|
|
|
// Sets the palette to contain the RGBA byte buffer pointed to by pPalette.
|
2018-06-13 19:15:16 +00:00
|
|
|
|
// If the surface is not initialized, the function returns immediately.
|
2018-06-25 14:53:46 +00:00
|
|
|
|
void glsurface_setPalette(void* pPalette);
|
2018-06-13 19:15:16 +00:00
|
|
|
|
|
|
|
|
|
// Returns a pointer to the start of the surface's pixel buffer
|
|
|
|
|
// Returns NULL if the surface is not initialized.
|
|
|
|
|
void* glsurface_getBuffer();
|
|
|
|
|
|
|
|
|
|
// Returns the resolution of the surface's buffer
|
|
|
|
|
vec2_t glsurface_getBufferResolution();
|
|
|
|
|
|
2018-06-25 14:53:46 +00:00
|
|
|
|
// Blit the surface's pixel buffer to the screen using the palette set with glsurface_setPalette().
|
2018-06-13 19:15:16 +00:00
|
|
|
|
// Renders as soon as the data has been uploaded.
|
|
|
|
|
// If the surface is not initialized, the function returns immediately.
|
2018-06-25 14:53:46 +00:00
|
|
|
|
void glsurface_blitBuffer();
|
2018-06-13 19:15:16 +00:00
|
|
|
|
|
|
|
|
|
#endif /* GLSURFACE_H_ */
|