ref_soft: glblit: change projection scale
This commit is contained in:
parent
e1efacb399
commit
2493659b23
1 changed files with 37 additions and 36 deletions
47
r_glblit.c
47
r_glblit.c
|
@ -148,13 +148,13 @@ static void R_Unlock_GL1( void )
|
||||||
pglVertex2f( 0, 0 );
|
pglVertex2f( 0, 0 );
|
||||||
|
|
||||||
pglTexCoord2f( 1, 0 );
|
pglTexCoord2f( 1, 0 );
|
||||||
pglVertex2f( vid.width, 0 );
|
pglVertex2f( 1, 0 );
|
||||||
|
|
||||||
pglTexCoord2f( 1, 1 );
|
pglTexCoord2f( 1, 1 );
|
||||||
pglVertex2f( vid.width, vid.height );
|
pglVertex2f( 1, 1 );
|
||||||
|
|
||||||
pglTexCoord2f( 0, 1 );
|
pglTexCoord2f( 0, 1 );
|
||||||
pglVertex2f( 0, vid.height );
|
pglVertex2f( 0, 1 );
|
||||||
pglEnd();
|
pglEnd();
|
||||||
gEngfuncs.GL_SwapBuffers();
|
gEngfuncs.GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
@ -162,23 +162,18 @@ static void R_Unlock_GL1( void )
|
||||||
|
|
||||||
static void R_Unlock_GLES1( void )
|
static void R_Unlock_GLES1( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vid.width, vid.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, glbuf );
|
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());
|
|
||||||
|
|
||||||
pglColor4f(1,1,1,1);
|
|
||||||
pglDrawArrays( GL_TRIANGLE_FAN, 0,4 );
|
pglDrawArrays( GL_TRIANGLE_FAN, 0,4 );
|
||||||
//gEngfuncs.Con_Printf("%d\n",pglGetError());
|
|
||||||
gEngfuncs.GL_SwapBuffers();
|
gEngfuncs.GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *R_CreateBuffer_GL1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
|
static qboolean R_CreateBuffer_GL1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
|
||||||
{
|
{
|
||||||
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
|
pglViewport( 0, 0, width, height );
|
||||||
pglMatrixMode( GL_PROJECTION );
|
pglMatrixMode( GL_PROJECTION );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
pglOrtho( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
|
pglOrtho( 0, 1, 1, 0, -99999, 99999 );
|
||||||
pglMatrixMode( GL_MODELVIEW );
|
pglMatrixMode( GL_MODELVIEW );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
|
|
||||||
|
@ -188,32 +183,34 @@ static void *R_CreateBuffer_GL1( int width, int height, uint *stride, uint *bpp,
|
||||||
|
|
||||||
if( glbuf )
|
if( glbuf )
|
||||||
Mem_Free(glbuf);
|
Mem_Free(glbuf);
|
||||||
|
|
||||||
glbuf = Mem_Malloc( r_temppool, width*height*2 );
|
glbuf = Mem_Malloc( r_temppool, width*height*2 );
|
||||||
|
|
||||||
*stride = width;
|
*stride = width;
|
||||||
*bpp = 2;
|
*bpp = 2;
|
||||||
*r = MASK(5) << 6 + 5;
|
*r = MASK(5) << 6 + 5;
|
||||||
*g = MASK(6) << 5;
|
*g = MASK(6) << 5;
|
||||||
*b = MASK(5);
|
*b = MASK(5);
|
||||||
return glbuf;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean R_CreateBuffer_GLES1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
|
static qboolean R_CreateBuffer_GLES1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
|
||||||
{
|
{
|
||||||
float data[] = {
|
float data[] = {
|
||||||
0, 0,
|
// quad verts match texcoords
|
||||||
width, 0,
|
|
||||||
width, height,
|
|
||||||
0, height,
|
|
||||||
0, 0,
|
0, 0,
|
||||||
1, 0,
|
1, 0,
|
||||||
1, 1,
|
1, 1,
|
||||||
0,1
|
0, 1,
|
||||||
};
|
};
|
||||||
int vbo;
|
int vbo;
|
||||||
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
|
|
||||||
|
pglViewport( 0, 0, width, height );
|
||||||
pglMatrixMode( GL_PROJECTION );
|
pglMatrixMode( GL_PROJECTION );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
pglOrthof( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
|
// project 0..1 to screen size
|
||||||
|
pglOrthof( 0, 1, 1, 0, -99999, 99999 );
|
||||||
pglMatrixMode( GL_MODELVIEW );
|
pglMatrixMode( GL_MODELVIEW );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
|
|
||||||
|
@ -221,29 +218,33 @@ static qboolean R_CreateBuffer_GLES1( int width, int height, uint *stride, uint
|
||||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||||
|
|
||||||
|
|
||||||
if( vbo )
|
if( vbo )
|
||||||
pglDeleteBuffers( 1,&vbo );
|
pglDeleteBuffers( 1,&vbo );
|
||||||
|
|
||||||
pglGenBuffers( 1,&vbo );
|
pglGenBuffers( 1,&vbo );
|
||||||
pglBindBuffer( GL_ARRAY_BUFFER_ARB, vbo );
|
pglBindBuffer( GL_ARRAY_BUFFER_ARB, vbo );
|
||||||
pglBufferData(GL_ARRAY_BUFFER_ARB,16*4,data, GL_STATIC_DRAW_ARB);
|
pglBufferData( GL_ARRAY_BUFFER_ARB, sizeof(data), data, GL_STATIC_DRAW_ARB );
|
||||||
|
|
||||||
pglEnableClientState( GL_VERTEX_ARRAY );
|
pglEnableClientState( GL_VERTEX_ARRAY );
|
||||||
pglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
pglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
|
|
||||||
pglVertexPointer( 2, GL_FLOAT, 8, 0 );
|
pglVertexPointer( 2, GL_FLOAT, 8, 0 );
|
||||||
pglTexCoordPointer(2,GL_FLOAT,8,(void*)32);
|
pglTexCoordPointer( 2, GL_FLOAT, 8, 0 );
|
||||||
pglBindBuffer( GL_ARRAY_BUFFER_ARB, 0 ) ;
|
pglBindBuffer( GL_ARRAY_BUFFER_ARB, 0 ) ;
|
||||||
|
pglColor4f( 1, 1, 1, 1 );
|
||||||
|
|
||||||
|
|
||||||
if( glbuf )
|
if( glbuf )
|
||||||
Mem_Free( glbuf );
|
Mem_Free( glbuf );
|
||||||
|
|
||||||
glbuf = Mem_Malloc( r_temppool, width*height*2 );
|
glbuf = Mem_Malloc( r_temppool, width*height*2 );
|
||||||
|
|
||||||
*stride = width;
|
*stride = width;
|
||||||
*bpp = 2;
|
*bpp = 2;
|
||||||
*r = MASK(5) << 6 + 5;
|
*r = MASK(5) << 6 + 5;
|
||||||
*g = MASK(6) << 5;
|
*g = MASK(6) << 5;
|
||||||
*b = MASK(5);
|
*b = MASK(5);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue