Replace glBegin/glEnd

This commit is contained in:
nillerusr
2021-11-21 18:51:30 +03:00
parent 4508c9c863
commit e8dd3cece3
8 changed files with 37 additions and 50 deletions
-12
View File
@@ -891,9 +891,6 @@ CGLMTex::CGLMTex( GLMContext *ctx, GLMTexLayout *layout, uint levels, const char
{
printf("\n minimizing storage for tex '%s' [%s] ", m_debugLabel?m_debugLabel:"-", m_layout->m_layoutSummary );
}
if (gGL->m_bHave_GL_APPLE_texture_range)
gGL->glTexParameteri( m_layout->m_key.m_texGLTarget, GL_TEXTURE_MINIMIZE_STORAGE_APPLE, 1 );
}
// after a lot of pain with texture completeness...
@@ -1359,10 +1356,6 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
// set up the client storage now, one way or another
// If this extension isn't supported, we just end up with two copies of the texture, one in the GL and one in app memory.
// So it's safe to just go on as if this extension existed and hold the possibly-unnecessary extra RAM.
if (gGL->m_bHave_GL_APPLE_client_storage)
{
gGL->glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, m_texClientStorage );
}
switch( target )
{
@@ -1509,11 +1502,6 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
break;
}
if (gGL->m_bHave_GL_APPLE_client_storage)
{
gGL->glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE );
}
if ( expandTemp )
{
free( expandTemp );
+1 -12
View File
@@ -379,18 +379,6 @@ COpenGLEntryPoints::COpenGLEntryPoints()
// !!! FIXME: hint Apple's drivers and not because we rely on the
// !!! FIXME: functionality. If so, just remove this check (and the
// !!! FIXME: GL_NV_fence code entirely).
#ifndef ANDROID // HACK
if ((m_bHave_OpenGL) && ((!m_bHave_GL_NV_fence) && (!m_bHave_GL_ARB_sync) && (!m_bHave_GL_APPLE_fence)))
{
// Error( "Required OpenGL extension \"GL_NV_fence\", \"GL_ARB_sync\", or \"GL_APPLE_fence\" is not supported. Please upgrade your OpenGL driver." );
}
#endif
// same extension, different name.
if (m_bHave_GL_EXT_vertex_array_bgra || m_bHave_GL_ARB_vertex_array_bgra)
{
m_bHave_GL_EXT_vertex_array_bgra = m_bHave_GL_ARB_vertex_array_bgra = true;
}
// GL_ARB_framebuffer_object is a superset of GL_EXT_framebuffer_object,
// (etc) but if you don't call in through the ARB entry points, you won't
@@ -400,6 +388,7 @@ COpenGLEntryPoints::COpenGLEntryPoints()
m_bHave_GL_EXT_framebuffer_object = true;
m_bHave_GL_EXT_framebuffer_blit = true;
m_bHave_GL_EXT_framebuffer_multisample = true;
m_bHave_GL_ARB_occlusion_query = true;
glBindFramebuffer.Force(glBindFramebuffer.Pointer());
glBindRenderbuffer.Force(glBindRenderbuffer.Pointer());
+15 -15
View File
@@ -1456,22 +1456,22 @@ void GLMContext::BlitTex( CGLMTex *srcTex, GLMRect *srcRect, int srcFace, int sr
// immediate mode is fine
float topv = 1.0;
float botv = 0.0;
gGL->glBegin(GL_QUADS);
gGL->glTexCoord2f ( 0.0, botv );
gGL->glVertex3f ( -1.0, -1.0, 0.0 );
gGL->glTexCoord2f ( 1.0, botv );
gGL->glVertex3f ( 1.0, -1.0, 0.0 );
gGL->glTexCoord2f ( 1.0, topv );
gGL->glVertex3f ( 1.0, 1.0, 0.0 );
const float topv = 1.0;
const float botv = 0.0;
gGL->glTexCoord2f ( 0.0, topv );
gGL->glVertex3f ( -1.0, 1.0, 0.0 );
gGL->glEnd();
const float verts[] = {-1.f, -1.f, 1.f, -1.f, 1.f, 1.f, -1.f, 1.f};
const float verts_tex[] = {0.f, botv, 1.f, botv, 1.f, topv, 0.f, topv};
gGL->glEnableClientState(GL_VERTEX_ARRAY);
gGL->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
gGL->glVertexPointer(2, GL_FLOAT, 0, verts);
gGL->glTexCoordPointer(2, GL_FLOAT, 0, verts_tex);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
gGL->glDisableClientState(GL_VERTEX_ARRAY);
gGL->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
gGL->glBindTexture( GL_TEXTURE_2D, 0 );