mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Correct depth texture intarnal format for GLES3
This commit is contained in:
parent
0a89aa9f77
commit
d3f6754cff
|
@ -120,11 +120,6 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * sizeof(float);
|
||||
textureCache().addFrameBufferTextureSize(_pTexture->textureBytes);
|
||||
|
||||
#ifndef GLES2
|
||||
const GLenum format = GL_DEPTH_COMPONENT;
|
||||
#else
|
||||
const GLenum format = GL_DEPTH_COMPONENT24_OES;
|
||||
#endif
|
||||
if (_multisample) {
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName);
|
||||
#ifndef GLESX
|
||||
|
@ -142,9 +137,9 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
if (_pBuffer != NULL)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT_FORMAT, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, video().getWidth(), video().getHeight(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT_FORMAT, video().getWidth(), video().getHeight(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
|
|
@ -71,4 +71,13 @@ extern const GLuint depthImageUnit;
|
|||
|
||||
void DepthBuffer_Init();
|
||||
void DepthBuffer_Destroy();
|
||||
|
||||
#ifdef GLES2
|
||||
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT24_OES
|
||||
#elif defined (GLES3)
|
||||
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT32F
|
||||
#else
|
||||
#define DEPTH_COMPONENT_FORMAT GL_DEPTH_COMPONENT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1045,7 +1045,7 @@ void DepthBufferToRDRAM::Init()
|
|||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, m_pDepthTexture->glName );
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, m_pDepthTexture->realWidth, m_pDepthTexture->realHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT_FORMAT, m_pDepthTexture->realWidth, m_pDepthTexture->realHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user