mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
remove legacy opengl code
This commit is contained in:
parent
b2cf1b0a55
commit
29478d6e25
@ -96,7 +96,6 @@ typedef struct IDirectDrawImpl
|
|||||||
BOOL fakecursorpos;
|
BOOL fakecursorpos;
|
||||||
BOOL noactivateapp;
|
BOOL noactivateapp;
|
||||||
char shader[MAX_PATH];
|
char shader[MAX_PATH];
|
||||||
BOOL autorenderer;
|
|
||||||
BOOL wine;
|
BOOL wine;
|
||||||
int sleep;
|
int sleep;
|
||||||
|
|
||||||
|
@ -1218,7 +1218,6 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
|||||||
else if (tolower(tmp[0]) == 'a')
|
else if (tolower(tmp[0]) == 'a')
|
||||||
{
|
{
|
||||||
printf("DirectDrawCreate: Using automatic renderer\n");
|
printf("DirectDrawCreate: Using automatic renderer\n");
|
||||||
This->autorenderer = TRUE;
|
|
||||||
|
|
||||||
DWORD version = GetVersion();
|
DWORD version = GetVersion();
|
||||||
DWORD major = (DWORD)(LOBYTE(LOWORD(version)));
|
DWORD major = (DWORD)(LOBYTE(LOWORD(version)));
|
||||||
|
274
src/render.c
274
src/render.c
@ -28,7 +28,7 @@ static HGLRC OpenGLContext;
|
|||||||
static int MaxFPS;
|
static int MaxFPS;
|
||||||
static BOOL VSyncEnabled;
|
static BOOL VSyncEnabled;
|
||||||
static DWORD FrameLength;
|
static DWORD FrameLength;
|
||||||
static GLuint PaletteConvertProgram;
|
static GLuint PaletteProgram;
|
||||||
static GLuint ScaleProgram;
|
static GLuint ScaleProgram;
|
||||||
static BOOL GotError;
|
static BOOL GotError;
|
||||||
static int SurfaceTexWidth;
|
static int SurfaceTexWidth;
|
||||||
@ -53,7 +53,7 @@ static HGLRC CreateContext(HDC hdc);
|
|||||||
static void SetMaxFPS(int baseMaxFPS);
|
static void SetMaxFPS(int baseMaxFPS);
|
||||||
static void BuildPrograms();
|
static void BuildPrograms();
|
||||||
static void CreateTextures(int width, int height);
|
static void CreateTextures(int width, int height);
|
||||||
static void InitPaletteConvertProgram();
|
static void InitPaletteProgram();
|
||||||
static void InitScaleProgram();
|
static void InitScaleProgram();
|
||||||
static void Render();
|
static void Render();
|
||||||
static void DeleteContext(HGLRC context);
|
static void DeleteContext(HGLRC context);
|
||||||
@ -75,13 +75,13 @@ DWORD WINAPI render_main(void)
|
|||||||
SetMaxFPS(ddraw->render.maxfps);
|
SetMaxFPS(ddraw->render.maxfps);
|
||||||
BuildPrograms();
|
BuildPrograms();
|
||||||
CreateTextures(ddraw->width, ddraw->height);
|
CreateTextures(ddraw->width, ddraw->height);
|
||||||
InitPaletteConvertProgram();
|
InitPaletteProgram();
|
||||||
InitScaleProgram();
|
InitScaleProgram();
|
||||||
|
|
||||||
GotError = GotError || !TextureUploadTest();
|
GotError = GotError || !TextureUploadTest();
|
||||||
GotError = GotError || !ShaderTest();
|
GotError = GotError || !ShaderTest();
|
||||||
GotError = GotError || glGetError() != GL_NO_ERROR;
|
GotError = GotError || glGetError() != GL_NO_ERROR;
|
||||||
UseOpenGL = !(ddraw->autorenderer && (!PaletteConvertProgram || GotError));
|
UseOpenGL = PaletteProgram && !GotError;
|
||||||
|
|
||||||
Render();
|
Render();
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static HGLRC CreateContext(HDC hdc)
|
|||||||
HGLRC context = wglCreateContext(hdc);
|
HGLRC context = wglCreateContext(hdc);
|
||||||
BOOL madeCurrent = context && wglMakeCurrent(hdc, context);
|
BOOL madeCurrent = context && wglMakeCurrent(hdc, context);
|
||||||
|
|
||||||
if (!madeCurrent || (ddraw->autorenderer && glGetError() != GL_NO_ERROR))
|
if (!madeCurrent || glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
if (madeCurrent)
|
if (madeCurrent)
|
||||||
{
|
{
|
||||||
@ -166,16 +166,16 @@ static void SetMaxFPS(int baseMaxFPS)
|
|||||||
|
|
||||||
static void BuildPrograms()
|
static void BuildPrograms()
|
||||||
{
|
{
|
||||||
PaletteConvertProgram = ScaleProgram = 0;
|
PaletteProgram = ScaleProgram = 0;
|
||||||
|
|
||||||
if (OpenGL_GotVersion3)
|
if (OpenGL_GotVersion3)
|
||||||
{
|
{
|
||||||
PaletteConvertProgram = OpenGL_BuildProgram(PassthroughVertShaderSrc, PaletteFragShaderSrc);
|
PaletteProgram = OpenGL_BuildProgram(PassthroughVertShaderSrc, PaletteFragShaderSrc);
|
||||||
ScaleProgram = OpenGL_BuildProgramFromFile(ddraw->shader);
|
ScaleProgram = OpenGL_BuildProgramFromFile(ddraw->shader);
|
||||||
}
|
}
|
||||||
else if (OpenGL_GotVersion2)
|
else if (OpenGL_GotVersion2)
|
||||||
{
|
{
|
||||||
PaletteConvertProgram = OpenGL_BuildProgram(PassthroughVertShader110Src, PaletteFragShader110Src);
|
PaletteProgram = OpenGL_BuildProgram(PassthroughVertShader110Src, PaletteFragShader110Src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,73 +207,43 @@ static void CreateTextures(int width, int height)
|
|||||||
|
|
||||||
while (glGetError() != GL_NO_ERROR);
|
while (glGetError() != GL_NO_ERROR);
|
||||||
|
|
||||||
if (PaletteConvertProgram)
|
glTexImage2D(
|
||||||
|
GL_TEXTURE_2D,
|
||||||
|
0,
|
||||||
|
GL_LUMINANCE8,
|
||||||
|
SurfaceTexWidth,
|
||||||
|
SurfaceTexHeight,
|
||||||
|
0,
|
||||||
|
SurfaceFormat = GL_LUMINANCE,
|
||||||
|
GL_UNSIGNED_BYTE,
|
||||||
|
0);
|
||||||
|
|
||||||
|
|
||||||
|
if (glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
GL_LUMINANCE8,
|
GL_R8,
|
||||||
SurfaceTexWidth,
|
SurfaceTexWidth,
|
||||||
SurfaceTexHeight,
|
SurfaceTexHeight,
|
||||||
0,
|
0,
|
||||||
SurfaceFormat = GL_LUMINANCE,
|
SurfaceFormat = GL_RED,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
glTexImage2D(
|
|
||||||
GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
GL_R8,
|
|
||||||
SurfaceTexWidth,
|
|
||||||
SurfaceTexHeight,
|
|
||||||
0,
|
|
||||||
SurfaceFormat = GL_RED,
|
|
||||||
GL_UNSIGNED_BYTE,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
glTexImage2D(
|
|
||||||
GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
GL_RED,
|
|
||||||
SurfaceTexWidth,
|
|
||||||
SurfaceTexHeight,
|
|
||||||
0,
|
|
||||||
SurfaceFormat = GL_RED,
|
|
||||||
GL_UNSIGNED_BYTE,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ddraw->autorenderer && glGetError() != GL_NO_ERROR) // very slow...
|
|
||||||
{
|
|
||||||
glTexImage2D(
|
|
||||||
GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
GL_RGBA8,
|
|
||||||
SurfaceTexWidth,
|
|
||||||
SurfaceTexHeight,
|
|
||||||
0,
|
|
||||||
SurfaceFormat = GL_RED,
|
|
||||||
GL_UNSIGNED_BYTE,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
GL_RGBA8,
|
GL_RED,
|
||||||
SurfaceTexWidth,
|
SurfaceTexWidth,
|
||||||
SurfaceTexHeight,
|
SurfaceTexHeight,
|
||||||
0,
|
0,
|
||||||
SurfaceFormat = GL_RGBA,
|
SurfaceFormat = GL_RED,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,20 +261,20 @@ static void CreateTextures(int width, int height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitPaletteConvertProgram()
|
static void InitPaletteProgram()
|
||||||
{
|
{
|
||||||
if (!PaletteConvertProgram)
|
if (!PaletteProgram)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glUseProgram(PaletteConvertProgram);
|
glUseProgram(PaletteProgram);
|
||||||
|
|
||||||
glUniform1i(glGetUniformLocation(PaletteConvertProgram, "SurfaceTex"), 0);
|
glUniform1i(glGetUniformLocation(PaletteProgram, "SurfaceTex"), 0);
|
||||||
glUniform1i(glGetUniformLocation(PaletteConvertProgram, "PaletteTex"), 1);
|
glUniform1i(glGetUniformLocation(PaletteProgram, "PaletteTex"), 1);
|
||||||
|
|
||||||
if (OpenGL_GotVersion3)
|
if (OpenGL_GotVersion3)
|
||||||
{
|
{
|
||||||
MainVertexCoordAttrLoc = glGetAttribLocation(PaletteConvertProgram, "VertexCoord");
|
MainVertexCoordAttrLoc = glGetAttribLocation(PaletteProgram, "VertexCoord");
|
||||||
MainTexCoordAttrLoc = glGetAttribLocation(PaletteConvertProgram, "TexCoord");
|
MainTexCoordAttrLoc = glGetAttribLocation(PaletteProgram, "TexCoord");
|
||||||
|
|
||||||
glGenBuffers(3, MainVBOs);
|
glGenBuffers(3, MainVBOs);
|
||||||
|
|
||||||
@ -382,7 +352,7 @@ static void InitPaletteConvertProgram()
|
|||||||
0,0,1,0,
|
0,0,1,0,
|
||||||
0,0,0,1,
|
0,0,0,1,
|
||||||
};
|
};
|
||||||
glUniformMatrix4fv(glGetUniformLocation(PaletteConvertProgram, "MVPMatrix"), 1, GL_FALSE, mvpMatrix);
|
glUniformMatrix4fv(glGetUniformLocation(PaletteProgram, "MVPMatrix"), 1, GL_FALSE, mvpMatrix);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -498,7 +468,7 @@ static void InitScaleProgram()
|
|||||||
if (glDeleteVertexArrays)
|
if (glDeleteVertexArrays)
|
||||||
glDeleteVertexArrays(1, &ScaleVAO);
|
glDeleteVertexArrays(1, &ScaleVAO);
|
||||||
|
|
||||||
if (PaletteConvertProgram)
|
if (PaletteProgram)
|
||||||
{
|
{
|
||||||
glBindVertexArray(MainVAO);
|
glBindVertexArray(MainVAO);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[0]);
|
||||||
@ -542,10 +512,7 @@ static void Render()
|
|||||||
ddraw->render.viewport.x, ddraw->render.viewport.y,
|
ddraw->render.viewport.x, ddraw->render.viewport.y,
|
||||||
ddraw->render.viewport.width, ddraw->render.viewport.height);
|
ddraw->render.viewport.width, ddraw->render.viewport.height);
|
||||||
|
|
||||||
if (PaletteConvertProgram)
|
glUseProgram(PaletteProgram);
|
||||||
glUseProgram(PaletteConvertProgram);
|
|
||||||
else
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
while (UseOpenGL && ddraw->render.run && WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED)
|
while (UseOpenGL && ddraw->render.run && WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED)
|
||||||
{
|
{
|
||||||
@ -584,72 +551,52 @@ static void Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PaletteConvertProgram)
|
if (InterlockedExchange(&ddraw->render.paletteUpdated, FALSE))
|
||||||
{
|
{
|
||||||
if (InterlockedExchange(&ddraw->render.paletteUpdated, FALSE))
|
if (++palIndex >= TEXTURE_COUNT)
|
||||||
{
|
palIndex = 0;
|
||||||
if (++palIndex >= TEXTURE_COUNT)
|
|
||||||
palIndex = 0;
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[palIndex]);
|
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[palIndex]);
|
||||||
|
|
||||||
glTexSubImage2D(
|
glTexSubImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
256,
|
256,
|
||||||
1,
|
1,
|
||||||
GL_RGBA,
|
GL_RGBA,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
ddraw->primary->palette->data_bgr);
|
ddraw->primary->palette->data_bgr);
|
||||||
}
|
|
||||||
|
|
||||||
if (InterlockedExchange(&ddraw->render.surfaceUpdated, FALSE))
|
|
||||||
{
|
|
||||||
if (++texIndex >= TEXTURE_COUNT)
|
|
||||||
texIndex = 0;
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
|
||||||
|
|
||||||
if (AdjustAlignment)
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
||||||
|
|
||||||
glTexSubImage2D(
|
|
||||||
GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
ddraw->width,
|
|
||||||
ddraw->height,
|
|
||||||
SurfaceFormat,
|
|
||||||
GL_UNSIGNED_BYTE,
|
|
||||||
ddraw->primary->surface);
|
|
||||||
|
|
||||||
if (AdjustAlignment)
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (InterlockedExchange(&ddraw->render.surfaceUpdated, FALSE))
|
||||||
{
|
{
|
||||||
int i, j;
|
if (++texIndex >= TEXTURE_COUNT)
|
||||||
for (i = 0; i<ddraw->height; i++)
|
texIndex = 0;
|
||||||
{
|
|
||||||
int i_dst = i*ddraw->width;
|
|
||||||
int i_src = i*ddraw->primary->lPitch;
|
|
||||||
|
|
||||||
for (j = 0; j<ddraw->width; j++)
|
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
||||||
{
|
|
||||||
SurfaceTex[i_dst + j] =
|
|
||||||
ddraw->primary->palette->data_bgr[
|
|
||||||
((unsigned char *)ddraw->primary->surface)[i_src + j*ddraw->primary->lXPitch]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (AdjustAlignment)
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
|
glTexSubImage2D(
|
||||||
|
GL_TEXTURE_2D,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
ddraw->width,
|
||||||
|
ddraw->height,
|
||||||
|
SurfaceFormat,
|
||||||
|
GL_UNSIGNED_BYTE,
|
||||||
|
ddraw->primary->surface);
|
||||||
|
|
||||||
|
if (AdjustAlignment)
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int errorCheckCount = 0;
|
static int errorCheckCount = 0;
|
||||||
if (ddraw->autorenderer && errorCheckCount < 3)
|
if (errorCheckCount < 3)
|
||||||
{
|
{
|
||||||
errorCheckCount++;
|
errorCheckCount++;
|
||||||
glFinish();
|
glFinish();
|
||||||
@ -661,25 +608,9 @@ static void Render()
|
|||||||
|
|
||||||
LeaveCriticalSection(&ddraw->cs);
|
LeaveCriticalSection(&ddraw->cs);
|
||||||
|
|
||||||
if (!PaletteConvertProgram)
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
|
||||||
|
|
||||||
glTexSubImage2D(
|
|
||||||
GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
ddraw->width,
|
|
||||||
ddraw->height,
|
|
||||||
GL_RGBA,
|
|
||||||
GL_UNSIGNED_BYTE,
|
|
||||||
SurfaceTex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scaleChanged)
|
if (scaleChanged)
|
||||||
{
|
{
|
||||||
if (ScaleProgram && PaletteConvertProgram)
|
if (ScaleProgram && PaletteProgram)
|
||||||
{
|
{
|
||||||
glBindVertexArray(MainVAO);
|
glBindVertexArray(MainVAO);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[1]);
|
||||||
@ -695,7 +626,7 @@ static void Render()
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
else if (OpenGL_GotVersion3 && PaletteConvertProgram)
|
else if (OpenGL_GotVersion3 && PaletteProgram)
|
||||||
{
|
{
|
||||||
glBindVertexArray(MainVAO);
|
glBindVertexArray(MainVAO);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, MainVBOs[1]);
|
||||||
@ -713,19 +644,18 @@ static void Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PaletteConvertProgram)
|
glActiveTexture(GL_TEXTURE0);
|
||||||
{
|
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SurfaceTexIds[texIndex]);
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[palIndex]);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ScaleProgram && PaletteConvertProgram)
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[palIndex]);
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
|
if (ScaleProgram && PaletteProgram)
|
||||||
{
|
{
|
||||||
// draw surface into framebuffer
|
// draw surface into framebuffer
|
||||||
glUseProgram(PaletteConvertProgram);
|
glUseProgram(PaletteProgram);
|
||||||
|
|
||||||
glViewport(0, 0, ddraw->width, ddraw->height);
|
glViewport(0, 0, ddraw->width, ddraw->height);
|
||||||
|
|
||||||
@ -758,7 +688,7 @@ static void Render()
|
|||||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
|
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
else if (OpenGL_GotVersion3 && PaletteConvertProgram)
|
else if (OpenGL_GotVersion3 && PaletteProgram)
|
||||||
{
|
{
|
||||||
glBindVertexArray(MainVAO);
|
glBindVertexArray(MainVAO);
|
||||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
|
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
|
||||||
@ -818,8 +748,8 @@ static void DeleteContext(HGLRC context)
|
|||||||
|
|
||||||
if (glDeleteProgram)
|
if (glDeleteProgram)
|
||||||
{
|
{
|
||||||
if (PaletteConvertProgram)
|
if (PaletteProgram)
|
||||||
glDeleteProgram(PaletteConvertProgram);
|
glDeleteProgram(PaletteProgram);
|
||||||
|
|
||||||
if (ScaleProgram)
|
if (ScaleProgram)
|
||||||
glDeleteProgram(ScaleProgram);
|
glDeleteProgram(ScaleProgram);
|
||||||
@ -827,7 +757,7 @@ static void DeleteContext(HGLRC context)
|
|||||||
|
|
||||||
if (OpenGL_GotVersion3)
|
if (OpenGL_GotVersion3)
|
||||||
{
|
{
|
||||||
if (PaletteConvertProgram)
|
if (PaletteProgram)
|
||||||
{
|
{
|
||||||
if (glDeleteBuffers)
|
if (glDeleteBuffers)
|
||||||
glDeleteBuffers(3, MainVBOs);
|
glDeleteBuffers(3, MainVBOs);
|
||||||
@ -907,7 +837,7 @@ static BOOL ShaderTest()
|
|||||||
{
|
{
|
||||||
BOOL result = TRUE;
|
BOOL result = TRUE;
|
||||||
|
|
||||||
if (OpenGL_GotVersion3 && PaletteConvertProgram)
|
if (OpenGL_GotVersion3 && PaletteProgram)
|
||||||
{
|
{
|
||||||
memset(SurfaceTex, 0, SurfaceTexHeight * SurfaceTexWidth * sizeof(int));
|
memset(SurfaceTex, 0, SurfaceTexHeight * SurfaceTexWidth * sizeof(int));
|
||||||
|
|
||||||
@ -960,7 +890,7 @@ static BOOL ShaderTest()
|
|||||||
|
|
||||||
glViewport(0, 0, SurfaceTexWidth, SurfaceTexHeight);
|
glViewport(0, 0, SurfaceTexWidth, SurfaceTexHeight);
|
||||||
|
|
||||||
glUseProgram(PaletteConvertProgram);
|
glUseProgram(PaletteProgram);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[0]);
|
glBindTexture(GL_TEXTURE_2D, PaletteTexIds[0]);
|
||||||
|
@ -43,7 +43,7 @@ DWORD WINAPI render_d3d9_main(void)
|
|||||||
SetStates();
|
SetStates();
|
||||||
|
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseDirect3D();
|
ReleaseDirect3D();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user