mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
adjust alignment in case width is not divisible 4 - fixes resolutions such as 1366*768
This commit is contained in:
parent
5bbf63a025
commit
4fe107c991
@ -49,6 +49,7 @@ static GLuint FrameBufferId;
|
|||||||
static GLuint FrameBufferTexId;
|
static GLuint FrameBufferTexId;
|
||||||
static GLuint ScaleVBOs[3], ScaleVAO;
|
static GLuint ScaleVBOs[3], ScaleVAO;
|
||||||
static BOOL UseOpenGL;
|
static BOOL UseOpenGL;
|
||||||
|
static BOOL AdjustAlignment;
|
||||||
|
|
||||||
static HGLRC CreateContext(HDC hdc);
|
static HGLRC CreateContext(HDC hdc);
|
||||||
static void SetMaxFPS(int baseMaxFPS);
|
static void SetMaxFPS(int baseMaxFPS);
|
||||||
@ -199,6 +200,8 @@ static void CreateTextures(int width, int height)
|
|||||||
|
|
||||||
SurfaceTex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, SurfaceTexWidth * SurfaceTexHeight * sizeof(int));
|
SurfaceTex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, SurfaceTexWidth * SurfaceTexHeight * sizeof(int));
|
||||||
|
|
||||||
|
AdjustAlignment = (width % 4) != 0;
|
||||||
|
|
||||||
ScaleW = (float)width / SurfaceTexWidth;
|
ScaleW = (float)width / SurfaceTexWidth;
|
||||||
ScaleH = (float)height / SurfaceTexHeight;
|
ScaleH = (float)height / SurfaceTexHeight;
|
||||||
|
|
||||||
@ -644,6 +647,9 @@ static void Render()
|
|||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
||||||
|
|
||||||
|
if (AdjustAlignment)
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
glTexSubImage2D(
|
glTexSubImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
@ -654,6 +660,9 @@ static void Render()
|
|||||||
SurfaceFormat,
|
SurfaceFormat,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
ddraw->primary->surface);
|
ddraw->primary->surface);
|
||||||
|
|
||||||
|
if (AdjustAlignment)
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user