Exemple #1
0
void Scrap_Upload (void)
{
	scrap_uploads++;
	GL_Bind(TEXNUM_SCRAPS);
	GL_Upload8 (scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, NULL );
	scrap_dirty = false;
}
Exemple #2
0
void
gl_R_LineGraph (int x, int y, int *h_vals, int count)
{
	byte        color;
	byte        *dest;
	int         size, h, i, j, s;

	if (!count)
		return;

	s = r_graphheight->int_val;

	size = s * count;
	if (size > graph_size[graph_index]) {
		graph_size[graph_index] = size;
		graph_texels[graph_index] = realloc (graph_texels[graph_index], size);
	}
	graph_width[graph_index] = count;

	if (!graph_texels[graph_index])
		Sys_Error ("R_LineGraph: failed to allocate texture buffer");

	i = 0;
	while (count--) {
		dest = graph_texels[graph_index] + i++;

		h = *h_vals++;

		if (h == 10000)
			color = 0x6f;					// yellow
		else if (h == 9999)
			color = 0x4f;					// red
		else if (h == 9998)
			color = 0xd0;					// blue
		else
			color = 0xfe;					// white

		if (h > s)
			h = s;

		for (j = 0; j < h; j++, dest += graph_width[graph_index])
			dest[0] = color;

		for (; j < s; j++, dest += graph_width[graph_index])
			dest[0] = 0xff;
	}

	qfglBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]);

	GL_Upload8 (graph_texels[graph_index], graph_width[graph_index], s, 0, 1);

	qfglBegin (GL_QUADS);
	qfglTexCoord2f (0, 0);
	qfglVertex2f (x, y);
	qfglTexCoord2f (1, 0);
	qfglVertex2f (x + graph_width[graph_index], y);
	qfglTexCoord2f (1, 1);
	qfglVertex2f (x + graph_width[graph_index], y - s);
	qfglTexCoord2f (0, 1);
	qfglVertex2f (x, y - s);
	qfglEnd ();

	graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES;
}