Browse Source

ref_soft: glblit: refactor

pull/2/head
mittorn 5 years ago
parent
commit
05d793c34b
  1. 79
      r_glblit.c

79
r_glblit.c

@ -70,6 +70,36 @@ void GAME_EXPORT GL_SetupAttributes( int safegl ) @@ -70,6 +70,36 @@ void GAME_EXPORT GL_SetupAttributes( int safegl )
void GAME_EXPORT GL_InitExtensions( void )
{
LOAD(glBegin);
LOAD(glEnd);
LOAD(glTexCoord2f);
LOAD(glVertex2f);
LOAD(glEnable);
LOAD(glDisable);
LOAD(glTexImage2D);
LOAD(glOrtho);
LOAD(glMatrixMode);
LOAD(glLoadIdentity);
LOAD(glViewport);
LOAD(glBindTexture);
LOAD(glDebugMessageCallbackARB);
LOAD(glDebugMessageControlARB);
LOAD(glGetError);
LOAD(glGenTextures);
LOAD(glTexParameteri);
#ifdef GLDEBUG
if( gpGlobals->developer )
{
gEngfuncs.Con_Reportf( "Installing GL_DebugOutput...\n");
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
// force everything to happen in the main thread instead of in a separate driver thread
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );
}
// enable all the low priority messages
pglDebugMessageControlARB( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true );
#endif
}
void GAME_EXPORT GL_ClearExtensions( void )
@ -84,16 +114,6 @@ static void *R_Lock_GL1( void ) @@ -84,16 +114,6 @@ static void *R_Lock_GL1( void )
static void R_Unlock_GL1( void )
{
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
pglMatrixMode( GL_PROJECTION );
pglLoadIdentity();
pglOrtho( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
pglMatrixMode( GL_MODELVIEW );
pglLoadIdentity();
pglEnable( GL_TEXTURE_2D );
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vid.width, vid.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, glbuf );
//gEngfuncs.Con_Printf("%d\n",pglGetError());
@ -110,43 +130,22 @@ static void R_Unlock_GL1( void ) @@ -110,43 +130,22 @@ static void R_Unlock_GL1( void )
pglTexCoord2f( 0, 1 );
pglVertex2f( 0, vid.height );
pglEnd();
pglDisable( GL_TEXTURE_2D );
gEngfuncs.GL_SwapBuffers();
}
static void *R_CreateBuffer_GL1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
pglMatrixMode( GL_PROJECTION );
pglLoadIdentity();
pglOrtho( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
pglMatrixMode( GL_MODELVIEW );
pglLoadIdentity();
LOAD(glBegin);
LOAD(glEnd);
LOAD(glTexCoord2f);
LOAD(glVertex2f);
LOAD(glEnable);
LOAD(glDisable);
LOAD(glTexImage2D);
LOAD(glOrtho);
LOAD(glMatrixMode);
LOAD(glLoadIdentity);
LOAD(glViewport);
LOAD(glBindTexture);
LOAD(glDebugMessageCallbackARB);
LOAD(glDebugMessageControlARB);
LOAD(glGetError);
LOAD(glGenTextures);
LOAD(glTexParameteri);
#ifdef GLDEBUG
if( gpGlobals->developer )
{
gEngfuncs.Con_Reportf( "Installing GL_DebugOutput...\n");
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
// force everything to happen in the main thread instead of in a separate driver thread
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );
}
pglEnable( GL_TEXTURE_2D );
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// enable all the low priority messages
pglDebugMessageControlARB( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true );
#endif
if( glbuf )
Mem_Free(glbuf);

Loading…
Cancel
Save