SDL: Support fullscreen on RPI (#1398)
Uses 24 a depth buffer if possible on OpenGL ES
This commit is contained in:
parent
43bc857b05
commit
8b015b65bd
4 changed files with 16 additions and 1 deletions
|
@ -476,10 +476,14 @@ void OpenGLSdlGraphicsManager::showOverlay() {
|
|||
_overlayBackground = nullptr;
|
||||
|
||||
if (g_engine) {
|
||||
if (_frameBuffer)
|
||||
_frameBuffer->detach();
|
||||
// If there is a game running capture the screen, so that it can be shown "below" the overlay.
|
||||
_overlayBackground = new OpenGL::TiledSurface(_overlayWidth, _overlayHeight, _overlayFormat);
|
||||
Graphics::Surface *background = _overlayBackground->getBackingSurface();
|
||||
glReadPixels(0, 0, background->w, background->h, GL_RGBA, GL_UNSIGNED_BYTE, background->getPixels());
|
||||
if (_frameBuffer)
|
||||
_frameBuffer->attach();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ void Context::reset() {
|
|||
packedDepthStencilSupported = false;
|
||||
unpackSubImageSupported = false;
|
||||
framebufferObjectMultisampleSupported = false;
|
||||
OESDepth24 = false;
|
||||
multisampleMaxSamples = -1;
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,10 @@ void Context::initialize(ContextType contextType) {
|
|||
EXTFramebufferMultisample = true;
|
||||
} else if (token == "GL_EXT_framebuffer_blit") {
|
||||
EXTFramebufferBlit = true;
|
||||
} else if (token == "GL_OES_depth24") {
|
||||
OESDepth24 = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int glslVersion = getGLSLVersion();
|
||||
|
|
|
@ -86,6 +86,9 @@ public:
|
|||
/** Whether specifying a pitch when uploading to textures is available or not */
|
||||
bool unpackSubImageSupported;
|
||||
|
||||
/** Whether depth component 24 is supported or not */
|
||||
bool OESDepth24;
|
||||
|
||||
int getGLSLVersion() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
#ifdef USE_GLES2
|
||||
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
|
||||
#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
|
||||
#endif
|
||||
|
||||
namespace OpenGL {
|
||||
|
@ -115,6 +116,9 @@ static void grabFramebufferObjectPointers() {
|
|||
static bool usePackedBuffer() {
|
||||
return OpenGLContext.packedDepthStencilSupported;
|
||||
}
|
||||
static bool useDepthComponent24() {
|
||||
return OpenGLContext.OESDepth24;
|
||||
}
|
||||
|
||||
FrameBuffer::FrameBuffer(uint width, uint height) :
|
||||
Texture(width, height) {
|
||||
|
@ -154,7 +158,7 @@ void FrameBuffer::init() {
|
|||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
} else {
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffers[0]);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, _texWidth, _texHeight);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, useDepthComponent24() ? GL_DEPTH_COMPONENT24 : GL_DEPTH_COMPONENT16, _texWidth, _texHeight);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderBuffers[0]);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffers[1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue