1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 10:07:47 +01:00

Fix crash race condition in OpenGL renderer

This commit is contained in:
Toni Spets 2010-11-08 17:34:33 +02:00
parent 2cb9affe28
commit 7a3086a3df

View File

@ -145,6 +145,8 @@ DWORD WINAPI render_opengl_main(IDirectDrawSurfaceImpl *surface)
}
/* convert ddraw surface to opengl texture */
if(surface->palette)
{
for(i=0; i<surface->height; i++)
{
for(j=0; j<surface->width; j++)
@ -152,6 +154,7 @@ DWORD WINAPI render_opengl_main(IDirectDrawSurfaceImpl *surface)
tex[i*surface->width+j] = surface->palette->data_bgr[((unsigned char *)surface->surface)[i*surface->lPitch + j*surface->lXPitch]];
}
}
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->width, surface->height, GL_RGBA, GL_UNSIGNED_BYTE, tex);