Initialize video and radar textures to black.
Prevents random crap from being blended into the borders and shown for the first video frame. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/qt-trunk@10985 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f9e5517b67
commit
8e3ff07969
|
@ -285,13 +285,16 @@ BOOL pie_ShutdownRadar(void)
|
|||
void pie_DownLoadRadar(UDWORD *buffer, int width, int height)
|
||||
{
|
||||
int w = 1, h = 1;
|
||||
char *black;
|
||||
|
||||
/* Find power of two size */
|
||||
while (width > (w *= 2));
|
||||
while (height > (h *= 2));
|
||||
|
||||
pie_SetTexturePage(radarTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
black = calloc(1, w * h * 4);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, black);
|
||||
free(black);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
|
|
@ -667,6 +667,7 @@ bool seq_Play(const char* filename)
|
|||
/* open video */
|
||||
if (theora_p)
|
||||
{
|
||||
char *blackframe = calloc(1, texture_width * texture_height * 4);
|
||||
if (videodata.ti.frame_width > texture_width ||
|
||||
videodata.ti.frame_height > texture_height)
|
||||
{
|
||||
|
@ -684,7 +685,8 @@ bool seq_Play(const char* filename)
|
|||
glGenTextures(1, &video_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, video_texture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_width, texture_height,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, blackframe);
|
||||
free(blackframe);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
|
|
Loading…
Reference in New Issue