The pretty green/yellow/blue pixels that hang around after things like

biosuits, pents, and quads wear off are now gone.  Sort of.  They are
caused by places where two texture edges meet and there are little gaps
at the seams where nothing gets drawn.  This is also why noclip screws w/
the screen if you walk outside of the map in the GL targets.  We now draw
a backdrop whose color is set by r_clearcolor, ala software renderer.
This commit is contained in:
Joseph Carter 2000-02-04 04:01:23 +00:00
parent 23b33b7173
commit 7e04ceced5
6 changed files with 103 additions and 40 deletions

View File

@ -47,6 +47,11 @@ int translate_texture;
int char_texture;
int cs_texture; // crosshair 2 texture
int cs_texture3; // crosshair 3 texture
int bc_texture; // used for noclip
static byte bc_data[4] = {
0xfe, 0xfe, 0xfe, 0xfe
};
static byte cs_data[64] = {
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
@ -417,6 +422,7 @@ void Draw_Init (void)
cs_texture3 = GL_LoadTexture ("crosshair3", 16, 16, cs_data3,
false, true);
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true);
bc_texture = GL_LoadTexture ("bctex", 2, 2, bc_data, false, true);
// For some reason which I cannot claim to fathom, it seems to be
// necessary to call GL_LoadTexture() here in descending (in terms
// of size) order else things don't work right. No idea why this

View File

@ -27,16 +27,19 @@
Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "mathlib.h"
#include "console.h"
#include "view.h"
#include "sound.h"
#include <qtypes.h>
#include <quakedef.h>
#include <glquake.h>
#include <mathlib.h>
#include <console.h>
#include <view.h>
#include <sound.h>
#include <cvar.h>
#include <sys.h>
#include <draw.h>
#include <sbar.h>
entity_t r_worldentity;
qboolean r_cache_thrash; // compatability
@ -82,6 +85,7 @@ texture_t *r_notexture_mip;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
cvar_t r_clearcolor = {"r_clearcolor", "2"};
void R_MarkLeaves (void);
@ -975,6 +979,34 @@ R_Clear ( void ) {
glDepthRange (gldepthmin, gldepthmax);
}
extern int bc_texture;
extern cvar_t crosshaircolor;
void TileBC (int x, int y, int w, int h)
{
unsigned char *pColor;
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
pColor = (unsigned char *) &d_8to24table[(byte) r_clearcolor.value];
glColor4ubv ( pColor );
GL_Bind (bc_texture);
glBegin (GL_QUADS);
glTexCoord2f (x/64.0, y/64.0);
glVertex2f (x, y);
glTexCoord2f ( (x+w)/64.0, y/64.0);
glVertex2f (x+w, y);
glTexCoord2f ( (x+w)/64.0, (y+h)/64.0);
glVertex2f (x+w, y+h);
glTexCoord2f ( x/64.0, (y+h)/64.0 );
glVertex2f (x, y+h);
glEnd ();
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
}
/*
R_RenderView
@ -993,6 +1025,11 @@ R_RenderView ( void ) {
if (!r_worldentity.model || !cl.worldmodel)
Sys_Error ("R_RenderView: NULL worldmodel");
if ((int)cl_sbar.value == 1)
TileBC (0, 0, vid.width, vid.height - sb_lines);
else
TileBC (0, 0, vid.width, vid.height);
if (r_speeds.value)
{
glFinish ();

View File

@ -1,4 +1,5 @@
/*
r_misc.c
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
@ -19,19 +20,20 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_misc.c
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "cvar.h"
#include "console.h"
#include <qtypes.h>
#include <quakedef.h>
#include <glquake.h>
#include <cvar.h>
#include <console.h>
#include <sys.h>
#include <lib_replace.h>
#include <cmd.h>
extern void R_InitBubble();
extern cvar_t r_clearcolor;
/*
==================
R_InitTextures
@ -205,6 +207,7 @@ void R_Init (void)
Cvar_RegisterVariable (&r_volfog);
#endif
Cvar_RegisterVariable (&r_waterripple);
Cvar_RegisterVariable (&r_clearcolor);
Cvar_RegisterVariable (&gl_clear);
Cvar_RegisterVariable (&gl_texsort);

View File

@ -467,13 +467,13 @@ LoadTGA (gzFile *fin) {
targa_header.colormap_type = gzgetc(fin);
targa_header.image_type = gzgetc(fin);
targa_header.colormap_index = fgetLittleShort(fin);
targa_header.colormap_length = fgetLittleShort(fin);
targa_header.colormap_size = fgetc(fin);
targa_header.x_origin = fgetLittleShort(fin);
targa_header.y_origin = fgetLittleShort(fin);
targa_header.width = fgetLittleShort(fin);
targa_header.height = fgetLittleShort(fin);
targa_header.colormap_index = gzgetLittleShort(fin);
targa_header.colormap_length = gzgetLittleShort(fin);
targa_header.colormap_size = gzgetc(fin);
targa_header.x_origin = gzgetLittleShort(fin);
targa_header.y_origin = gzgetLittleShort(fin);
targa_header.width = gzgetLittleShort(fin);
targa_header.height = gzgetLittleShort(fin);
targa_header.pixel_size = gzgetc(fin);
targa_header.attributes = gzgetc(fin);
@ -601,7 +601,8 @@ LoadTGA (gzFile *fin) {
breakOut:;
}
}
fclose(fin);
gzclose(fin);
// fclose(fin);
}
/*

View File

@ -1,4 +1,5 @@
/*
render.h - public interface to both GL and software renderers
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
@ -23,10 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _RENDER_H
#define _RENDER_H
#include "qtypes.h"
#include "vid.h"
#include <qtypes.h>
#include <vid.h>
// refresh.h -- public interface to refresh functions
#define MAXCLIPPLANES 11

View File

@ -123,31 +123,47 @@ typedef struct
{
cactive_t state;
#ifdef QUAKEWORLD
netchan_t netchan;
char userinfo[MAX_INFO_STRING];
char servername[MAX_OSPATH];
// download stuff
int qport;
FILE *download;
char downloadtempname[MAX_OSPATH];
char downloadname[MAX_OSPATH];
int downloadnumber;
dltyle_t downloadtype;
int downloadpercent;
int challenge;
float latency;
#endif
#ifdef UQUAKE
// personalization data sent to server
char mapstring[MAX_QPATH];
char spawnparms[MAX_MAPSTRING]; // to restart a level
// demo loop control
int demonum; // -1 = don't play demos
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
// connection information
int signon; // 0 to SIGNONS
struct qsocket_s *netcon;
sizebuf_t message; // net msg write buffer
#endif
// demo recording info must be here, because record is started before
// entering a map (and clearing client_state_t)
// demos - this stuff can't go into client_state_t
int demonum; // -1 == don't play
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
qboolean demorecording;
qboolean demoplayback;
qboolean timedemo;
int forcetrack; // -1 = use normal cd track
int forcetrack; // -1 == normal cd track
gzFile *demofile;
int td_lastframe; // to meter out one message a frame
int td_startframe; // host_framecount at start
float td_starttime; // realtime at second frame of timedemo
// connection information
int signon; // 0 to SIGNONS
struct qsocket_s *netcon;
sizebuf_t message; // writing buffer to send to server
int td_lastframe; // for msg timing
int td_startframe; // inits to host_framecount
float td_starttime; // of 2nd frame of timedemo
} client_static_t;
extern client_static_t cls;