mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
More fixes to try and build
This commit is contained in:
parent
bdb808b3f8
commit
c1cc1097f5
18 changed files with 361 additions and 127 deletions
|
@ -26,7 +26,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../rd-common/tr_public.h"
|
||||
#include "../rd-common/tr_font.h"
|
||||
|
||||
extern refimport_t ri;
|
||||
//extern refimport_t *ri;
|
||||
|
||||
/*
|
||||
================================================================================
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#ifdef HAVE_GLES
|
||||
#include <GLES/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
|
|
|
@ -483,7 +483,7 @@ static void RB_BeginDrawingView (void) {
|
|||
clearBits |= GL_COLOR_BUFFER_BIT;
|
||||
if (tr.world && tr.world->globalFog != -1)
|
||||
{
|
||||
const fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
const jk_fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
qglClearColor(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f );
|
||||
}
|
||||
else
|
||||
|
@ -499,7 +499,7 @@ static void RB_BeginDrawingView (void) {
|
|||
{
|
||||
if (tr.world && tr.world->globalFog != -1)
|
||||
{
|
||||
const fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
const jk_fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
qglClearColor(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f );
|
||||
}
|
||||
else
|
||||
|
@ -514,7 +514,7 @@ static void RB_BeginDrawingView (void) {
|
|||
{
|
||||
if (tr.world && tr.world->globalFog != -1)
|
||||
{ //this is because of a bug in multiple scenes I think, it needs to clear for the second scene but it doesn't normally.
|
||||
const fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
const jk_fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
|
||||
qglClearColor(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f );
|
||||
clearBits |= GL_COLOR_BUFFER_BIT;
|
||||
|
@ -550,7 +550,11 @@ static void RB_BeginDrawingView (void) {
|
|||
// clip to the plane of the portal
|
||||
if ( backEnd.viewParms.isPortal ) {
|
||||
float plane[4];
|
||||
#ifdef HAVE_GLES
|
||||
float plane2[4];
|
||||
#else
|
||||
double plane2[4];
|
||||
#endif
|
||||
|
||||
plane[0] = backEnd.viewParms.portalPlane.normal[0];
|
||||
plane[1] = backEnd.viewParms.portalPlane.normal[1];
|
||||
|
@ -924,7 +928,11 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
}
|
||||
|
||||
//now copy a portion of the screen to this texture
|
||||
#ifdef HAVE_GLES
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cX, cY, rad, rad, 0);
|
||||
#else
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, cX, cY, rad, rad, 0);
|
||||
#endif
|
||||
|
||||
lastPostEnt = pRender->entNum;
|
||||
}
|
||||
|
@ -1333,6 +1341,7 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
combiner (pixel shader), I combine the adjacent pixels using a weighting factor. - Aurelio
|
||||
*/
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
// Render dynamic glowing/flaring objects.
|
||||
if ( !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && g_bDynamicGlowSupported && r_DynamicGlow->integer )
|
||||
{
|
||||
|
@ -1389,6 +1398,7 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
// Draw the glow additively over the screen.
|
||||
RB_DrawGlowOverlay();
|
||||
}
|
||||
#endif
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
@ -1405,19 +1415,21 @@ const void *RB_DrawBuffer( const void *data ) {
|
|||
|
||||
cmd = (const drawBufferCommand_t *)data;
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
qglDrawBuffer( cmd->buffer );
|
||||
#endif
|
||||
|
||||
// clear screen for debugging
|
||||
if (!( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && tr.world && tr.refdef.rdflags & RDF_doLAGoggles)
|
||||
{
|
||||
const fog_t *fog = &tr.world->fogs[tr.world->numfogs];
|
||||
const jk_fog_t *fog = &tr.world->fogs[tr.world->numfogs];
|
||||
|
||||
qglClearColor(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f );
|
||||
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
else if (!( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && tr.world && tr.world->globalFog != -1 && tr.sceneCount)//don't clear during menus, wait for real scene
|
||||
{
|
||||
const fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
const jk_fog_t *fog = &tr.world->fogs[tr.world->globalFog];
|
||||
|
||||
qglClearColor(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f );
|
||||
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
@ -1477,19 +1489,29 @@ Also called by RE_EndRegistration
|
|||
void RB_ShowImages( void ) {
|
||||
image_t *image;
|
||||
float x, y, w, h;
|
||||
//int start, end;
|
||||
// int start, end;
|
||||
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
|
||||
qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
qglFinish();
|
||||
|
||||
//start = ri.Milliseconds();
|
||||
// start = ri->Milliseconds()*ri->Cvar_VariableValue( "timescale" );
|
||||
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (glcol)
|
||||
qglDisableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#endif
|
||||
int i=0;
|
||||
// int iNumImages =
|
||||
R_Images_StartIteration();
|
||||
R_Images_StartIteration();
|
||||
while ( (image = R_Images_GetNextIteration()) != NULL)
|
||||
{
|
||||
w = glConfig.vidWidth / 20;
|
||||
|
@ -1504,23 +1526,48 @@ void RB_ShowImages( void ) {
|
|||
}
|
||||
|
||||
GL_Bind( image );
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
GLfloat tex[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
1, 1,
|
||||
0, 1
|
||||
};
|
||||
GLfloat vtx[] = {
|
||||
x, y,
|
||||
x + w, y,
|
||||
x + w, y + h,
|
||||
x, y + h
|
||||
};
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
|
||||
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
|
||||
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
||||
#else
|
||||
qglBegin (GL_QUADS);
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( 1, 0 );
|
||||
qglVertex2f( x + w, y );
|
||||
qglTexCoord2f( 1, 1 );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglTexCoord2f( 0, 1 );
|
||||
qglVertex2f( x, y + h );
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( 1, 0 );
|
||||
qglVertex2f( x + w, y );
|
||||
qglTexCoord2f( 1, 1 );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglTexCoord2f( 0, 1 );
|
||||
qglVertex2f( x, y + h );
|
||||
qglEnd();
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
if (glcol)
|
||||
qglEnableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#endif
|
||||
qglFinish();
|
||||
|
||||
//end = ri.Milliseconds();
|
||||
//ri.Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
|
||||
// end = ri->Milliseconds()*ri->Cvar_VariableValue( "timescale" );
|
||||
// ri->Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1548,12 +1595,13 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
|
||||
// we measure overdraw by reading back the stencil buffer and
|
||||
// counting up the number of increments that have happened
|
||||
#ifndef HAVE_GLES
|
||||
if ( r_measureOverdraw->integer ) {
|
||||
int i;
|
||||
long sum = 0;
|
||||
unsigned char *stencilReadback;
|
||||
|
||||
stencilReadback = (unsigned char *) R_Malloc( glConfig.vidWidth * glConfig.vidHeight, TAG_TEMP_WORKSPACE, qfalse );
|
||||
stencilReadback = (unsigned char *)Hunk_AllocateTempMemory( glConfig.vidWidth * glConfig.vidHeight );
|
||||
qglReadPixels( 0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencilReadback );
|
||||
|
||||
for ( i = 0; i < glConfig.vidWidth * glConfig.vidHeight; i++ ) {
|
||||
|
@ -1561,8 +1609,9 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
}
|
||||
|
||||
backEnd.pc.c_overDraw += sum;
|
||||
R_Free( stencilReadback );
|
||||
Hunk_FreeTempMemory( stencilReadback );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !glState.finishCalled ) {
|
||||
qglFinish();
|
||||
|
@ -1650,6 +1699,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
|
||||
}
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
// What Pixel Shader type is currently active (regcoms or fragment programs).
|
||||
GLuint g_uiCurrentPixelShaderType = 0x0;
|
||||
|
||||
|
@ -1671,9 +1721,9 @@ void BeginPixelShader( GLuint uiType, GLuint uiID )
|
|||
|
||||
g_uiCurrentPixelShaderType = GL_REGISTER_COMBINERS_NV;
|
||||
}
|
||||
return;
|
||||
return;
|
||||
|
||||
// Using Fragment Programs, so call the program.
|
||||
// Using Fragment Programs, so call the program.
|
||||
case GL_FRAGMENT_PROGRAM_ARB:
|
||||
{
|
||||
// Just in case...
|
||||
|
@ -1685,7 +1735,7 @@ void BeginPixelShader( GLuint uiType, GLuint uiID )
|
|||
|
||||
g_uiCurrentPixelShaderType = GL_FRAGMENT_PROGRAM_ARB;
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1706,6 +1756,7 @@ static inline void RB_BlurGlowTexture()
|
|||
{
|
||||
qglDisable (GL_CLIP_PLANE0);
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
qglDisable( GL_DEPTH_TEST );
|
||||
|
||||
// Go into orthographic 2d mode.
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
|
@ -1716,7 +1767,7 @@ static inline void RB_BlurGlowTexture()
|
|||
qglPushMatrix();
|
||||
qglLoadIdentity();
|
||||
|
||||
GL_State(GLS_DEPTHTEST_DISABLE);
|
||||
GL_State(0);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Setup vertex and pixel programs.
|
||||
|
@ -1757,21 +1808,21 @@ static inline void RB_BlurGlowTexture()
|
|||
GLuint uiTex = tr.screenGlow;
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE3_ARB );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE2_ARB );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Draw the blur passes (each pass blurs it more, increasing the blur radius ).
|
||||
|
@ -1791,6 +1842,8 @@ static inline void RB_BlurGlowTexture()
|
|||
// After first pass put the tex coords to the viewport size.
|
||||
if ( iNumBlurPasses == 1 )
|
||||
{
|
||||
// OK, very weird, but dependent on which texture rectangle extension we're using, the
|
||||
// texture either needs to be always texure correct or view correct...
|
||||
if ( !g_bTextureRectangleHack )
|
||||
{
|
||||
iTexWidth = backEnd.viewParms.viewportWidth;
|
||||
|
@ -1800,43 +1853,43 @@ static inline void RB_BlurGlowTexture()
|
|||
uiTex = tr.blurImage;
|
||||
qglActiveTextureARB( GL_TEXTURE3_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
qglActiveTextureARB( GL_TEXTURE2_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
|
||||
// Copy the current image over.
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, uiTex );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
}
|
||||
|
||||
// Draw the fullscreen quad.
|
||||
qglBegin( GL_QUADS );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, iTexHeight );
|
||||
qglVertex2f( 0, 0 );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, iTexHeight );
|
||||
qglVertex2f( 0, 0 );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 0 );
|
||||
qglVertex2f( 0, backEnd.viewParms.viewportHeight );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 0 );
|
||||
qglVertex2f( 0, backEnd.viewParms.viewportHeight );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, 0 );
|
||||
qglVertex2f( backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, 0 );
|
||||
qglVertex2f( backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, iTexHeight );
|
||||
qglVertex2f( backEnd.viewParms.viewportWidth, 0 );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, iTexHeight );
|
||||
qglVertex2f( backEnd.viewParms.viewportWidth, 0 );
|
||||
qglEnd();
|
||||
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, tr.blurImage );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.blurImage );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
|
||||
|
||||
// Increase the texel offsets.
|
||||
// NOTE: This is possibly the most important input to the effect. Even by using an exponential function I've been able to
|
||||
|
@ -1849,16 +1902,16 @@ static inline void RB_BlurGlowTexture()
|
|||
|
||||
// Disable multi-texturing.
|
||||
qglActiveTextureARB( GL_TEXTURE3_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE2_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
|
||||
qglDisable( GL_VERTEX_PROGRAM_ARB );
|
||||
|
@ -1870,6 +1923,8 @@ static inline void RB_BlurGlowTexture()
|
|||
qglPopMatrix();
|
||||
|
||||
qglDisable( GL_BLEND );
|
||||
qglEnable( GL_DEPTH_TEST );
|
||||
|
||||
glState.currenttmu = 0; //this matches the last one we activated
|
||||
}
|
||||
|
||||
|
@ -1878,6 +1933,7 @@ static inline void RB_DrawGlowOverlay()
|
|||
{
|
||||
qglDisable (GL_CLIP_PLANE0);
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
qglDisable( GL_DEPTH_TEST );
|
||||
|
||||
// Go into orthographic 2d mode.
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
|
@ -1888,29 +1944,29 @@ static inline void RB_DrawGlowOverlay()
|
|||
qglPushMatrix();
|
||||
qglLoadIdentity();
|
||||
|
||||
GL_State(GLS_DEPTHTEST_DISABLE);
|
||||
GL_State(0);
|
||||
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
|
||||
// For debug purposes.
|
||||
if ( r_DynamicGlow->integer != 2 )
|
||||
{
|
||||
// Render the normal scene texture.
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, tr.sceneImage );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.sceneImage );
|
||||
qglBegin(GL_QUADS);
|
||||
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
qglTexCoord2f( 0, glConfig.vidHeight );
|
||||
qglVertex2f( 0, 0 );
|
||||
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
qglTexCoord2f( 0, glConfig.vidHeight );
|
||||
qglVertex2f( 0, 0 );
|
||||
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( 0, glConfig.vidHeight );
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( 0, glConfig.vidHeight );
|
||||
|
||||
qglTexCoord2f( glConfig.vidWidth, 0 );
|
||||
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglTexCoord2f( glConfig.vidWidth, 0 );
|
||||
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
qglTexCoord2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglVertex2f( glConfig.vidWidth, 0 );
|
||||
qglTexCoord2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglVertex2f( glConfig.vidWidth, 0 );
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
|
@ -1927,29 +1983,84 @@ static inline void RB_DrawGlowOverlay()
|
|||
qglEnable( GL_BLEND );
|
||||
|
||||
// Now additively render the glow texture.
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_ARB, tr.blurImage );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.blurImage );
|
||||
qglBegin(GL_QUADS);
|
||||
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
qglTexCoord2f( 0, r_DynamicGlowHeight->integer );
|
||||
qglVertex2f( 0, 0 );
|
||||
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
qglTexCoord2f( 0, r_DynamicGlowHeight->integer );
|
||||
qglVertex2f( 0, 0 );
|
||||
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( 0, glConfig.vidHeight );
|
||||
qglTexCoord2f( 0, 0 );
|
||||
qglVertex2f( 0, glConfig.vidHeight );
|
||||
|
||||
qglTexCoord2f( r_DynamicGlowWidth->integer, 0 );
|
||||
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglTexCoord2f( r_DynamicGlowWidth->integer, 0 );
|
||||
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
qglTexCoord2f( r_DynamicGlowWidth->integer, r_DynamicGlowHeight->integer );
|
||||
qglVertex2f( glConfig.vidWidth, 0 );
|
||||
qglTexCoord2f( r_DynamicGlowWidth->integer, r_DynamicGlowHeight->integer );
|
||||
qglVertex2f( glConfig.vidWidth, 0 );
|
||||
qglEnd();
|
||||
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_ARB );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglBlendFunc( GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR );
|
||||
qglDisable( GL_BLEND );
|
||||
|
||||
// NOTE: Multi-texture wasn't that much faster (we're obviously not bottlenecked by transform pipeline),
|
||||
// and besides, soft glow looks better anyways.
|
||||
/* else
|
||||
{
|
||||
int iTexWidth = glConfig.vidWidth, iTexHeight = glConfig.vidHeight;
|
||||
if ( GL_TEXTURE_RECTANGLE_EXT == GL_TEXTURE_RECTANGLE_NV )
|
||||
{
|
||||
iTexWidth = r_DynamicGlowWidth->integer;
|
||||
iTexHeight = r_DynamicGlowHeight->integer;
|
||||
}
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.screenGlow );
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.sceneImage );
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
||||
|
||||
qglBegin(GL_QUADS);
|
||||
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE1_ARB, 0, iTexHeight );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, glConfig.vidHeight );
|
||||
qglVertex2f( 0, 0 );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE1_ARB, 0, 0 );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 0 );
|
||||
qglVertex2f( 0, glConfig.vidHeight );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE1_ARB, iTexWidth, 0 );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, glConfig.vidWidth, 0 );
|
||||
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE1_ARB, iTexWidth, iTexHeight );
|
||||
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglVertex2f( glConfig.vidWidth, 0 );
|
||||
qglEnd();
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB );
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
}*/
|
||||
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglPopMatrix();
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglPopMatrix();
|
||||
|
||||
qglEnable( GL_DEPTH_TEST );
|
||||
}
|
||||
#endif //HAVE_GLES
|
||||
|
|
|
@ -981,7 +981,7 @@ R_LoadFogs
|
|||
*/
|
||||
static void R_LoadFogs( lump_t *l, lump_t *brushesLump, lump_t *sidesLump, world_t &worldData, int index ) {
|
||||
int i;
|
||||
fog_t *out;
|
||||
jk_fog_t *out;
|
||||
dfog_t *fogs;
|
||||
dbrush_t *brushes, *brush;
|
||||
dbrushside_t *sides;
|
||||
|
@ -1001,7 +1001,7 @@ static void R_LoadFogs( lump_t *l, lump_t *brushesLump, lump_t *sidesLump, world
|
|||
|
||||
// create fog strucutres for them
|
||||
worldData.numfogs = count + 1;
|
||||
worldData.fogs = (fog_t *)R_Hunk_Alloc ( (worldData.numfogs+1)*sizeof(*out), qtrue);
|
||||
worldData.fogs = (jk_fog_t *)R_Hunk_Alloc ( (worldData.numfogs+1)*sizeof(*out), qtrue);
|
||||
worldData.globalFog = -1;
|
||||
out = worldData.fogs + 1;
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ void RE_LAGoggles( void )
|
|||
tr.refdef.rdflags |= (RDF_doLAGoggles|RDF_doFullbright);
|
||||
tr.refdef.doLAGoggles = qtrue;
|
||||
|
||||
fog_t *fog = &tr.world->fogs[tr.world->numfogs];
|
||||
jk_fog_t *fog = &tr.world->fogs[tr.world->numfogs];
|
||||
|
||||
fog->parms.color[0] = 0.75f;
|
||||
fog->parms.color[1] = 0.42f + Q_flrand(0.0f, 1.0f) * 0.025f;
|
||||
|
|
|
@ -443,6 +443,7 @@ static int PowerOf2(int iArg)
|
|||
return iArg;
|
||||
}
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
Dissolve_t Dissolve={0};
|
||||
#define fDISSOLVE_SECONDS 0.75f
|
||||
|
||||
|
@ -1060,4 +1061,4 @@ qboolean RE_InitDissolve(qboolean bForceCircularExtroWipe)
|
|||
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -786,7 +786,7 @@ R_AComputeFogNum
|
|||
static int R_GComputeFogNum( trRefEntity_t *ent ) {
|
||||
|
||||
int i;
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
|
||||
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
|
||||
return 0;
|
||||
|
|
|
@ -126,9 +126,9 @@ void GL_TextureMode( const char *string ) {
|
|||
}
|
||||
|
||||
if ( i == numTextureModes ) {
|
||||
ri->Printf( PRINT_ALL, "bad filter name\n" );
|
||||
ri.Printf( PRINT_ALL, "bad filter name\n" );
|
||||
for ( i = 0; i < numTextureModes ; i++ ) {
|
||||
ri->Printf( PRINT_ALL, "%s\n", modes[i].name );
|
||||
ri.Printf( PRINT_ALL, "%s\n", modes[i].name );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void GL_TextureMode( const char *string ) {
|
|||
|
||||
// If the level they requested is less than possible, set the max possible...
|
||||
if ( r_ext_texture_filter_anisotropic->value > glConfig.maxTextureFilterAnisotropy )
|
||||
ri->Cvar_SetValue( "r_ext_texture_filter_anisotropic", glConfig.maxTextureFilterAnisotropy );
|
||||
ri.Cvar_SetValue( "r_ext_texture_filter_anisotropic", glConfig.maxTextureFilterAnisotropy );
|
||||
|
||||
// change all the existing mipmap texture objects
|
||||
R_Images_StartIteration();
|
||||
|
|
|
@ -33,7 +33,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "tr_WorldEffects.h"
|
||||
|
||||
glconfig_t glConfig;
|
||||
glstate_t glState;
|
||||
jk_glstate_t glState;
|
||||
window_t window;
|
||||
|
||||
static void GfxInfo_f( void );
|
||||
|
@ -185,6 +185,7 @@ cvar_t *com_buildScript;
|
|||
cvar_t *r_environmentMapping;
|
||||
cvar_t *r_screenshotJpegQuality;
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
#if !defined(__APPLE__)
|
||||
PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
|
||||
#endif
|
||||
|
@ -207,6 +208,7 @@ PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC qglGetCombinerOutputParameterfvNV;
|
|||
PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC qglGetCombinerOutputParameterivNV;
|
||||
PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC qglGetFinalCombinerInputParameterfvNV;
|
||||
PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC qglGetFinalCombinerInputParameterivNV;
|
||||
#endif
|
||||
|
||||
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB;
|
||||
PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
|
||||
|
@ -228,8 +230,10 @@ PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
|
|||
PFNGLGETPROGRAMSTRINGARBPROC qglGetProgramStringARB;
|
||||
PFNGLISPROGRAMARBPROC qglIsProgramARB;
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
|
||||
PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
||||
#endif
|
||||
|
||||
bool g_bTextureRectangleHack = false;
|
||||
|
||||
|
@ -261,7 +265,7 @@ void R_Splash()
|
|||
const float y2 = 240 + height / 2;
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
GLimp_EndFrame();
|
||||
//GLimp_EndFrame();
|
||||
GLfloat tex[] = {
|
||||
0,0 ,
|
||||
1,0,
|
||||
|
@ -489,6 +493,7 @@ static void GLimp_InitExtensions( void )
|
|||
glConfig.clampToEdgeAvailable = qtrue;
|
||||
Com_Printf ("...using GL_EXT_texture_edge_clamp\n" );
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
// GL_ARB_multitexture
|
||||
qglMultiTexCoord2fARB = NULL;
|
||||
qglActiveTextureARB = NULL;
|
||||
|
@ -553,6 +558,7 @@ static void GLimp_InitExtensions( void )
|
|||
}
|
||||
|
||||
bool bNVRegisterCombiners = false;
|
||||
|
||||
// Register Combiners.
|
||||
if ( ri.GL_ExtensionSupported( "GL_NV_register_combiners" ) )
|
||||
{
|
||||
|
@ -600,7 +606,7 @@ static void GLimp_InitExtensions( void )
|
|||
bNVRegisterCombiners = false;
|
||||
Com_Printf ("...GL_NV_register_combiners not found\n" );
|
||||
}
|
||||
|
||||
#endif
|
||||
// NOTE: Vertex and Fragment Programs are very dependant on each other - this is actually a
|
||||
// good thing! So, just check to see which we support (one or the other) and load the shared
|
||||
// function pointers. ARB rocks!
|
||||
|
@ -686,6 +692,7 @@ static void GLimp_InitExtensions( void )
|
|||
// Find out how many general combiners they have.
|
||||
#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
|
||||
GLint iNumGeneralCombiners = 0;
|
||||
bool bNVRegisterCombiners = false;
|
||||
if(bNVRegisterCombiners)
|
||||
qglGetIntegerv( GL_MAX_GENERAL_COMBINERS_NV, &iNumGeneralCombiners );
|
||||
|
||||
|
@ -704,11 +711,13 @@ static void GLimp_InitExtensions( void )
|
|||
}
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
#ifndef HAVE_GLES
|
||||
qglStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)ri.GL_GetProcAddress("glStencilOpSeparate");
|
||||
if (qglStencilOpSeparate)
|
||||
{
|
||||
glConfig.doStencilShadowsInOneDrawcall = qtrue;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
glConfig.doStencilShadowsInOneDrawcall = qtrue;
|
||||
#endif
|
||||
|
@ -1824,6 +1833,7 @@ void RE_Shutdown( qboolean destroyWindow, qboolean restarting ) {
|
|||
for ( size_t i = 0; i < numCommands; i++ )
|
||||
ri.Cmd_RemoveCommand( commands[i].cmd );
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
if ( r_DynamicGlow && r_DynamicGlow->integer )
|
||||
{
|
||||
// Release the Glow Vertex Shader.
|
||||
|
@ -1856,6 +1866,7 @@ void RE_Shutdown( qboolean destroyWindow, qboolean restarting ) {
|
|||
// Release the blur texture.
|
||||
qglDeleteTextures( 1, &tr.blurImage );
|
||||
}
|
||||
#endif
|
||||
|
||||
R_ShutdownWorldEffects();
|
||||
R_ShutdownFonts();
|
||||
|
|
|
@ -31,10 +31,15 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "mdx_format.h"
|
||||
#include "qgl.h"
|
||||
|
||||
#if defined(_XBOX) || defined(HAVE_GLES)
|
||||
#define GL_INDEX_TYPE GL_UNSIGNED_SHORT
|
||||
typedef unsigned short glIndex_t;
|
||||
#else
|
||||
#define GL_INDEX_TYPE GL_UNSIGNED_INT
|
||||
typedef unsigned int glIndex_t;
|
||||
#endif
|
||||
|
||||
extern refimport_t ri;
|
||||
//extern refimport_t ri;
|
||||
|
||||
|
||||
// 13 bits
|
||||
|
@ -529,7 +534,7 @@ typedef struct {
|
|||
// for clipping distance in fog when outside
|
||||
qboolean hasSurface;
|
||||
float surface[4];
|
||||
} fog_t;
|
||||
} jk_fog_t;
|
||||
|
||||
typedef struct {
|
||||
orientationr_t ori;
|
||||
|
@ -769,7 +774,7 @@ typedef struct {
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numfogs;
|
||||
fog_t *fogs;
|
||||
jk_fog_t *fogs;
|
||||
int globalFog;
|
||||
|
||||
int startLightMapIndex;
|
||||
|
@ -902,7 +907,7 @@ typedef struct {
|
|||
#define FUNCTABLE_MASK (FUNCTABLE_SIZE-1)
|
||||
|
||||
|
||||
// the renderer front end should never modify glstate_t
|
||||
// the renderer front end should never modify jk_glstate_t
|
||||
typedef struct {
|
||||
int currenttextures[2];
|
||||
int currenttmu;
|
||||
|
@ -910,7 +915,7 @@ typedef struct {
|
|||
int texEnv[2];
|
||||
int faceCulling;
|
||||
uint32_t glStateBits;
|
||||
} glstate_t;
|
||||
} jk_glstate_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -1076,7 +1081,7 @@ void R_Images_DeleteImage(image_t *pImage);
|
|||
extern backEndState_t backEnd;
|
||||
extern trGlobals_t tr;
|
||||
extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init
|
||||
extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init
|
||||
extern jk_glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init
|
||||
extern window_t window;
|
||||
|
||||
|
||||
|
|
|
@ -1049,7 +1049,7 @@ See if a sprite is inside a fog volume
|
|||
*/
|
||||
int R_SpriteFogNum( trRefEntity_t *ent ) {
|
||||
int i;
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
|
||||
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
|
||||
return 0;
|
||||
|
@ -1475,7 +1475,7 @@ void R_SetViewFogIndex (void)
|
|||
{
|
||||
if ( tr.world->numfogs > 1 )
|
||||
{//more than just the LA goggles
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
int contents = ri.SV_PointContents( tr.refdef.vieworg, 0 );
|
||||
if ( (contents&CONTENTS_FOG) )
|
||||
{//only take a tr.refdef.fogIndex if the tr.refdef.vieworg is actually *in* that fog brush (assumption: checks pointcontents for any CONTENTS_FOG, not that particular brush...)
|
||||
|
|
|
@ -242,7 +242,7 @@ R_ComputeFogNum
|
|||
*/
|
||||
static int R_ComputeFogNum( md3Header_t *header, trRefEntity_t *ent ) {
|
||||
int i;
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
md3Frame_t *md3Frame;
|
||||
vec3_t localOrigin;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void CQuickSpriteSystem::Flush(void)
|
|||
if (mUseFog && r_drawfog->integer == 2 &&
|
||||
mFogIndex == tr.world->globalFog)
|
||||
{ //enable hardware fog when we draw this thing if applicable -rww
|
||||
fog_t *fog = tr.world->fogs + mFogIndex;
|
||||
jk_fog_t *fog = tr.world->fogs + mFogIndex;
|
||||
|
||||
qglFogf(GL_FOG_MODE, GL_EXP2);
|
||||
qglFogf(GL_FOG_DENSITY, logtestExp2 / fog->parms.depthForOpaque);
|
||||
|
@ -163,7 +163,7 @@ void CQuickSpriteSystem::Flush(void)
|
|||
if (mUseFog && (r_drawfog->integer != 2 || mFogIndex != tr.world->globalFog))
|
||||
#endif
|
||||
{
|
||||
fog_t *fog = tr.world->fogs + mFogIndex;
|
||||
jk_fog_t *fog = tr.world->fogs + mFogIndex;
|
||||
|
||||
//
|
||||
// render the fog pass
|
||||
|
|
|
@ -120,7 +120,7 @@ void RE_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *vert
|
|||
srfPoly_t *poly;
|
||||
int i;
|
||||
int fogIndex = 0;
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
vec3_t bounds[2];
|
||||
|
||||
if ( !tr.registered ) {
|
||||
|
|
|
@ -51,6 +51,8 @@ This is just for OpenGL conformance testing, it should never be the fastest
|
|||
================
|
||||
*/
|
||||
static void APIENTRY R_ArrayElementDiscrete( GLint index ) {
|
||||
|
||||
#ifndef HAVE_GLES
|
||||
qglColor4ubv( tess.svars.colors[ index ] );
|
||||
if ( glState.currenttmu ) {
|
||||
qglMultiTexCoord2fARB( 0, tess.svars.texcoords[ 0 ][ index ][0], tess.svars.texcoords[ 0 ][ index ][1] );
|
||||
|
@ -59,6 +61,7 @@ static void APIENTRY R_ArrayElementDiscrete( GLint index ) {
|
|||
qglTexCoord2fv( tess.svars.texcoords[ 0 ][ index ] );
|
||||
}
|
||||
qglVertex3fv( tess.xyz[ index ] );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,6 +70,7 @@ R_DrawStripElements
|
|||
|
||||
===================
|
||||
*/
|
||||
#ifndef HAVE_GLES
|
||||
static int c_vertexes; // for seeing how long our average strips are
|
||||
static int c_begins;
|
||||
static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void ( APIENTRY *element )(GLint) ) {
|
||||
|
@ -74,13 +78,14 @@ static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void
|
|||
glIndex_t last[3];
|
||||
qboolean even;
|
||||
|
||||
qglBegin( GL_TRIANGLE_STRIP );
|
||||
c_begins++;
|
||||
|
||||
if ( numIndexes <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
qglBegin( GL_TRIANGLE_STRIP );
|
||||
|
||||
// prime the strip
|
||||
element( indexes[0] );
|
||||
element( indexes[1] );
|
||||
|
@ -106,8 +111,8 @@ static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void
|
|||
assert( (int)indexes[i+2] < tess.numVertexes );
|
||||
even = qtrue;
|
||||
}
|
||||
// otherwise we're done with this strip so finish it and start
|
||||
// a new one
|
||||
// otherwise we're done with this strip so finish it and start
|
||||
// a new one
|
||||
else
|
||||
{
|
||||
qglEnd();
|
||||
|
@ -134,8 +139,8 @@ static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void
|
|||
|
||||
even = qfalse;
|
||||
}
|
||||
// otherwise we're done with this strip so finish it and start
|
||||
// a new one
|
||||
// otherwise we're done with this strip so finish it and start
|
||||
// a new one
|
||||
else
|
||||
{
|
||||
qglEnd();
|
||||
|
@ -160,6 +165,8 @@ static void R_DrawStripElements( int numIndexes, const glIndex_t *indexes, void
|
|||
|
||||
qglEnd();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -187,12 +194,36 @@ static void R_DrawElements( int numIndexes, const glIndex_t *indexes ) {
|
|||
|
||||
if ( primitives == 2 ) {
|
||||
qglDrawElements( GL_TRIANGLES,
|
||||
numIndexes,
|
||||
GL_INDEX_TYPE,
|
||||
indexes );
|
||||
numIndexes,
|
||||
GL_INDEX_TYPE,
|
||||
indexes );
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_GLES)
|
||||
if (primitives == 1 || primitives == 3)
|
||||
{
|
||||
// if (tess.useConstantColor)
|
||||
// {
|
||||
// qglDisableClientState( GL_COLOR_ARRAY );
|
||||
// qglColor4ubv( tess.constantColor );
|
||||
// }
|
||||
/*qglDrawElements( GL_TRIANGLES,
|
||||
numIndexes,
|
||||
GL_INDEX_TYPE,
|
||||
indexes );*/
|
||||
#if 1 // VVFIXME : Temporary solution to try and increase framerate
|
||||
//qglIndexedTriToStrip( numIndexes, indexes );
|
||||
|
||||
qglDrawElements( GL_TRIANGLES,
|
||||
numIndexes,
|
||||
GL_INDEX_TYPE,
|
||||
indexes );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
#else // HAVE_GLES
|
||||
if ( primitives == 1 ) {
|
||||
R_DrawStripElements( numIndexes, indexes, qglArrayElement );
|
||||
return;
|
||||
|
@ -202,14 +233,13 @@ static void R_DrawElements( int numIndexes, const glIndex_t *indexes ) {
|
|||
R_DrawStripElements( numIndexes, indexes, R_ArrayElementDiscrete );
|
||||
return;
|
||||
}
|
||||
#endif // HAVE_GLES
|
||||
|
||||
// anything else will cause no drawing
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
|
@ -1331,7 +1361,7 @@ Blends a fog texture on top of everything else
|
|||
===================
|
||||
*/
|
||||
static void RB_FogPass( void ) {
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
int i;
|
||||
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
|
@ -1496,7 +1526,7 @@ static void ComputeColors( shaderStage_t *pStage, alphaGen_t forceAlphaGen, colo
|
|||
break;
|
||||
case CGEN_FOG:
|
||||
{
|
||||
const fog_t *fog = tr.world->fogs + tess.fogNum;
|
||||
const jk_fog_t *fog = tr.world->fogs + tess.fogNum;
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++ ) {
|
||||
byteAlias_t *ba = (byteAlias_t *)&tess.svars.colors[i];
|
||||
|
@ -1804,7 +1834,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
#ifndef JK2_MODE
|
||||
bool UseGLFog = false;
|
||||
bool FogColorChange = false;
|
||||
fog_t *fog = NULL;
|
||||
jk_fog_t *fog = NULL;
|
||||
|
||||
if (tess.fogNum && tess.shader->fogPass && (tess.fogNum == tr.world->globalFog || tess.fogNum == tr.world->numfogs)
|
||||
&& r_drawfog->value == 2)
|
||||
|
|
|
@ -821,7 +821,7 @@ void RB_CalcFogTexCoords( float *st ) {
|
|||
float s, t;
|
||||
float eyeT;
|
||||
qboolean eyeOutside;
|
||||
fog_t *fog;
|
||||
jk_fog_t *fog;
|
||||
vec3_t localVec;
|
||||
vec4_t fogDistanceVector, fogDepthVector;
|
||||
|
||||
|
|
|
@ -677,7 +677,11 @@ void RB_CaptureScreenImage(void)
|
|||
cY = 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cX, cY, radX, radY, 0);
|
||||
#else
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, cX, cY, radX, radY, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -750,20 +754,49 @@ void RB_DistortionFill(void)
|
|||
GL_State(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
if (glcol)
|
||||
qglDisableClientState( GL_COLOR_ARRAY );
|
||||
GLfloat tex[] = {
|
||||
0+spost2, 1-spost,
|
||||
0+spost2, 0+spost,
|
||||
1-spost2, 0+spost,
|
||||
1-spost2, 1-spost
|
||||
};
|
||||
GLfloat vtx[] = {
|
||||
0, 0,
|
||||
0, glConfig.vidHeight,
|
||||
glConfig.vidWidth, glConfig.vidHeight,
|
||||
glConfig.vidWidth, 0
|
||||
};
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
|
||||
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
|
||||
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
||||
/* if (glcol)
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );*/
|
||||
#else
|
||||
qglBegin(GL_QUADS);
|
||||
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
qglTexCoord2f(0+spost2, 1-spost);
|
||||
qglVertex2f(0, 0);
|
||||
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
qglTexCoord2f(0+spost2, 1-spost);
|
||||
qglVertex2f(0, 0);
|
||||
|
||||
qglTexCoord2f(0+spost2, 0+spost);
|
||||
qglVertex2f(0, glConfig.vidHeight);
|
||||
qglTexCoord2f(0+spost2, 0+spost);
|
||||
qglVertex2f(0, glConfig.vidHeight);
|
||||
|
||||
qglTexCoord2f(1-spost2, 0+spost);
|
||||
qglVertex2f(glConfig.vidWidth, glConfig.vidHeight);
|
||||
qglTexCoord2f(1-spost2, 0+spost);
|
||||
qglVertex2f(glConfig.vidWidth, glConfig.vidHeight);
|
||||
|
||||
qglTexCoord2f(1-spost2, 1-spost);
|
||||
qglVertex2f(glConfig.vidWidth, 0);
|
||||
qglTexCoord2f(1-spost2, 1-spost);
|
||||
qglVertex2f(glConfig.vidWidth, 0);
|
||||
qglEnd();
|
||||
#endif
|
||||
|
||||
if (tr_distortionAlpha == 1.0f && tr_distortionStretch == 0.0f)
|
||||
{ //no overrides
|
||||
|
|
|
@ -371,22 +371,62 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
|
|||
int s, t;
|
||||
|
||||
GL_Bind( image );
|
||||
#ifdef HAVE_GLES
|
||||
GLfloat vtx[3*1024]; // arbitrary sized
|
||||
GLfloat tex[2*1024];
|
||||
int idx;
|
||||
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (glcol)
|
||||
qglDisableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#endif
|
||||
|
||||
|
||||
for ( t = mins[1]+HALF_SKY_SUBDIVISIONS; t < maxs[1]+HALF_SKY_SUBDIVISIONS; t++ )
|
||||
{
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
idx=0;
|
||||
#else
|
||||
qglBegin( GL_TRIANGLE_STRIP );
|
||||
#endif
|
||||
|
||||
for ( s = mins[0]+HALF_SKY_SUBDIVISIONS; s <= maxs[0]+HALF_SKY_SUBDIVISIONS; s++ )
|
||||
{
|
||||
#ifdef HAVE_GLES
|
||||
memcpy(tex+idx*2, s_skyTexCoords[t][s], sizeof(GLfloat)*2);
|
||||
memcpy(vtx+idx*3, s_skyPoints[t][s], sizeof(GLfloat)*3);
|
||||
idx++;
|
||||
memcpy(tex+idx*2, s_skyTexCoords[t+1][s], sizeof(GLfloat)*2);
|
||||
memcpy(vtx+idx*3, s_skyPoints[t+1][s], sizeof(GLfloat)*3);
|
||||
idx++;
|
||||
#else
|
||||
qglTexCoord2fv( s_skyTexCoords[t][s] );
|
||||
qglVertex3fv( s_skyPoints[t][s] );
|
||||
|
||||
qglTexCoord2fv( s_skyTexCoords[t+1][s] );
|
||||
qglVertex3fv( s_skyPoints[t+1][s] );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLES
|
||||
|
||||
qglVertexPointer (3, GL_FLOAT, 0, vtx);
|
||||
qglTexCoordPointer(2, GL_FLOAT, 0, tex);
|
||||
qglDrawArrays(GL_TRIANGLE_STRIP, 0, idx);
|
||||
#else
|
||||
qglEnd();
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_GLES
|
||||
if (glcol)
|
||||
qglEnableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DrawSkyBox( shader_t *shader )
|
||||
|
|
Loading…
Reference in a new issue