fix conflitc
This commit is contained in:
1 parent
d0b0a7490a
commit
7304988071
17 files changed
+379
-420
No files matched your search
+12
-10
@@ -15,6 +15,8 @@
|
||||
#include "hw_main.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
@@ -63,7 +65,7 @@ void HWR_StartBatching(void)
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
@@ -74,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,13 +292,13 @@ void HWR_RenderBatches(void)
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -411,7 +413,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GL_DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -429,7 +431,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -437,8 +439,8 @@ void HWR_RenderBatches(void)
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
// texture should be already ready for use from calls to GL_SetTexture during batch collection
|
||||
GL_SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+15
-15
@@ -16,7 +16,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
@@ -494,7 +494,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GL_DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -505,7 +505,7 @@ void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_ClearMipMapCache();
|
||||
|
||||
// free all hardware-converted graphics cached in the heap
|
||||
// our gool is only the textures since user of the texture is the texture cache
|
||||
@@ -572,7 +572,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gltex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&gltex->mipmap);
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -660,7 +660,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -689,7 +689,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -719,7 +719,7 @@ void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(glPatch->mipmap);
|
||||
GL_SetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
@@ -894,7 +894,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
@@ -927,11 +927,11 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
|
||||
crushed_palette[i].s.alpha = 255;
|
||||
}
|
||||
HWD.pfnSetScreenPalette(crushed_palette);
|
||||
GL_SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GL_SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
@@ -941,7 +941,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GL_SetPalette(palette);
|
||||
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
|
||||
memset(mapPalette, 0, sizeof(mapPalette));
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
@@ -974,7 +974,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -1022,7 +1022,7 @@ void HWR_SetMapPalette(void)
|
||||
// in palette rendering mode, this means that all rgba textures now have wrong colors
|
||||
// and the lookup table is outdated
|
||||
HWR_SetPaletteLookup(mapPalette);
|
||||
HWD.pfnSetTexturePalette(mapPalette);
|
||||
GL_SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
@@ -1045,7 +1045,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
|
||||
for (i = 0; i < 256 * 32; i++)
|
||||
hw_lighttable[i] = palette[lighttable[i]];
|
||||
|
||||
id = HWD.pfnCreateLightTable(hw_lighttable);
|
||||
id = GL_CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GL_ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
+21
-21
@@ -20,7 +20,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
#include "../m_misc.h" //FIL_WriteFile()
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
@@ -122,7 +122,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
@@ -303,10 +303,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
@@ -460,10 +460,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -539,7 +539,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -575,10 +575,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
HWD.pfnMakeScreenTexture(scr_tex);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_MakeScreenTexture(scr_tex);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GL_UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +629,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
GL_Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -879,7 +879,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1029,7 +1029,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
@@ -1191,7 +1191,7 @@ UINT8 *HWR_GetScreenshot(void)
|
||||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gpu.h
|
||||
/// \brief GPU low-level interface API
|
||||
|
||||
#ifndef __HWR_GPU_H__
|
||||
#define __HWR_GPU_H__
|
||||
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
boolean GL_Init (void);
|
||||
void GL_FinishUpdate (INT32 waitvbl);
|
||||
void SetupGLInfo (void);
|
||||
|
||||
void GL_SetSpecialState (hwdspecialstate_t IdState, INT32 Value);
|
||||
void GL_SetTransform (FTransform *stransform);
|
||||
void GL_SetBlend (FBITFIELD PolyFlags);
|
||||
void GL_SetPalette (RGBA_t *palette);
|
||||
void GL_ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void GL_DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void GL_DrawIndexedTriangles (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
void GL_Draw2DLine (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
|
||||
void GL_RenderSkyDome (gl_sky_t *sky);
|
||||
|
||||
void GL_SetTexture (GLMipmap_t *pTexInfo);
|
||||
void GL_UpdateTexture (GLMipmap_t *pTexInfo);
|
||||
void GL_DeleteTexture (GLMipmap_t *pTexInfo);
|
||||
|
||||
void GL_Flush(void);
|
||||
#define GL_ClearMipMapCache GL_Flush
|
||||
|
||||
INT32 GL_GetTextureUsed (void);
|
||||
|
||||
void GL_CreateModelVBOs (model_t *model);
|
||||
|
||||
void GL_ReadScreenTexture (int tex, UINT16 *dst_data);
|
||||
void GL_GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void GL_MakeScreenTexture (int tex);
|
||||
void GL_FlushScreenTextures (void);
|
||||
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void GL_DoScreenWipe (int wipeStart, int wipeEnd);
|
||||
void GL_RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void GL_DrawScreenFinalTexture (int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
void GL_PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean GL_InitShaders (void);
|
||||
void GL_LoadShader (int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean GL_CompileShader (int slot);
|
||||
void GL_SetShader (int slot);
|
||||
void GL_UnSetShader (void);
|
||||
|
||||
void GL_SetShaderInfo (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void GL_SetPaletteLookup (UINT8 *lut);
|
||||
UINT32 GL_CreateLightTable (RGBA_t *hw_lighttable);
|
||||
void GL_ClearLightTables (void);
|
||||
void GL_SetScreenPalette (RGBA_t *palette);
|
||||
|
||||
#endif // __HWR_GPU_H__
|
||||
+57
-55
@@ -14,13 +14,14 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
#include "hw_md2.h"
|
||||
#include "hw_clip.h"
|
||||
@@ -63,8 +64,6 @@
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel)
|
||||
|
||||
struct hwdriver_s hwdriver;
|
||||
|
||||
// false if shaders have not been initialized yet, or if shaders are not available
|
||||
boolean gl_shadersavailable = false;
|
||||
|
||||
@@ -242,7 +241,7 @@ static void CV_screentextures_OnChange(void)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
M_UpdateOGLMenu();
|
||||
}
|
||||
|
||||
@@ -283,13 +282,13 @@ static void CV_gllightdithering_OnChange(void)
|
||||
static void CV_filtermode_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_anisotropic_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
}
|
||||
|
||||
static void CV_glpaletterendering_OnChange(void)
|
||||
@@ -324,7 +323,7 @@ boolean HWR_UseShader(void)
|
||||
|
||||
static void HWR_SetShaderState(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
}
|
||||
|
||||
boolean HWR_ShouldUsePaletteRendering(void)
|
||||
@@ -1117,10 +1116,10 @@ static void HWR_DrawSkyWallList(void)
|
||||
surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_UnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4226,7 +4225,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
PS_START_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
// Okay! Let's draw it all! Woo!
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -5072,7 +5071,7 @@ static void HWR_DrawSkyBackground(void)
|
||||
if (drewsky)
|
||||
return;
|
||||
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
memcpy(&dometransform, &atransform, sizeof(FTransform));
|
||||
|
||||
@@ -5094,9 +5093,9 @@ static void HWR_DrawSkyBackground(void)
|
||||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
HWD.pfnSetTransform(&dometransform);
|
||||
HWD.pfnRenderSkyDome(&gl_sky);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
GL_SetTransform(&dometransform);
|
||||
GL_RenderSkyDome(&gl_sky);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -5104,12 +5103,12 @@ static void HWR_DrawSkyBackground(void)
|
||||
// -----------------+
|
||||
static inline void HWR_ClearView(void)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
HWD.pfnClearBuffer(false, true, true, NULL);
|
||||
GL_GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -5131,7 +5130,7 @@ void HWR_SetViewSize(void)
|
||||
gl_baseviewwindowy = 0;
|
||||
gl_baseviewwindowx = 0;
|
||||
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
}
|
||||
|
||||
// Set view aiming, for the sky dome, the skybox,
|
||||
@@ -5196,7 +5195,7 @@ void HWR_SetTransform(float fpov, player_t *player)
|
||||
atransform.mirrorflip = true;
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
}
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
@@ -5213,8 +5212,8 @@ void HWR_ClearClipper(void)
|
||||
void HWR_SetStencilState(int state, int level)
|
||||
{
|
||||
if (level > -1)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
GL_SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
GL_SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
@@ -5270,7 +5269,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -5314,7 +5313,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gl_collect_skywalls = false;
|
||||
@@ -5385,11 +5384,11 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
if (!skybox && cv_glrenderdistance.value)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||
GL_GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
||||
}
|
||||
|
||||
@@ -5397,8 +5396,8 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
|
||||
|
||||
// Unset transform and shader
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
if (!skybox)
|
||||
@@ -5406,7 +5405,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -5436,11 +5435,14 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||
ClearColor.blue = 0.0f;
|
||||
ClearColor.alpha = 1.0f;
|
||||
|
||||
HWD.pfnClearBuffer(true, false, false, &ClearColor);
|
||||
GL_ClearBuffer(true, false, false, &ClearColor);
|
||||
}
|
||||
|
||||
if (HWR_UseShader() && cv_ripplewater.value)
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
if (cv_ripplewater.value)
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
}
|
||||
|
||||
if (viewnumber > 3)
|
||||
return;
|
||||
@@ -5507,7 +5509,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5521,7 +5523,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5591,7 +5593,7 @@ void HWR_Startup(void)
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
if (msaa)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
GL_SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
}
|
||||
startupdone = true;
|
||||
}
|
||||
@@ -5605,9 +5607,9 @@ void HWR_Shutdown(void)
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_Disable();
|
||||
GL_Framebuffer_Disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5650,12 +5652,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
|
||||
|
||||
INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return HWD.pfnGetTextureUsed();
|
||||
return GL_GetTextureUsed();
|
||||
}
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player)
|
||||
{
|
||||
HWD.pfnUnSetShader();
|
||||
GL_UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
@@ -5679,7 +5681,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
|
||||
@@ -5687,7 +5689,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
@@ -5727,28 +5729,28 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
HWD.pfnPostImgRedraw(v);
|
||||
GL_PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
}
|
||||
// Flipping of the screen isn't done here anymore
|
||||
}
|
||||
|
||||
void HWR_StartScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
void HWR_EndScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
@@ -5782,22 +5784,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
}
|
||||
|
||||
HWR_GetFadeMask(lumpnum);
|
||||
HWD.pfnDoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
+13
-11
@@ -25,12 +25,13 @@
|
||||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
#include "../r_fps.h"
|
||||
#include "../r_main.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
@@ -417,7 +418,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap);
|
||||
GL_SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
@@ -467,7 +468,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
@@ -1048,11 +1049,11 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the Mipmap
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
@@ -1063,7 +1064,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
@@ -1084,10 +1085,11 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
GL_SetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
@@ -1233,7 +1235,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1288,7 +1290,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1461,7 +1463,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
@@ -1478,7 +1480,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.y += ox * gl_viewcos;
|
||||
p.z += oy;
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "hw_clip.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
@@ -153,7 +153,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
@@ -87,7 +87,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GL_InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
@@ -366,16 +366,16 @@ static void HWR_CompileShader(int index)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GL_CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"#endif\n" \
|
||||
"}\n"
|
||||
|
||||
// lighting cap adjustment:
|
||||
// first num (155.0), increase to make it start to go dark sooner
|
||||
// second num (0.26), increase to make it go dark faster
|
||||
|
||||
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
||||
else
|
||||
textureformatGL = GL_RGB5_A1;
|
||||
|
||||
SetModelView(lvid->width, lvid->height);
|
||||
SetStates();
|
||||
GL_SetModelView(lvid->width, lvid->height);
|
||||
GL_SetStates();
|
||||
// we need to clear the depth buffer. Very important!!!
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
||||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void GL_FinishUpdate (INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Set the color lookup table for paletted textures
|
||||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = pal[i].s.red;
|
||||
myPaletteData[i].s.green = pal[i].s.green;
|
||||
myPaletteData[i].s.blue = pal[i].s.blue;
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+132
-137
@@ -40,8 +40,6 @@
|
||||
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
|
||||
#include "../../i_video.h"
|
||||
|
||||
extern fixed_t fovtan; // also extremely bad, I'm just too lazy!!!
|
||||
|
||||
struct GLRGBAFloat
|
||||
{
|
||||
GLfloat red;
|
||||
@@ -706,8 +704,8 @@ static gl_shaderstate_t gl_shaderstate;
|
||||
static float shader_leveltime = 0;
|
||||
|
||||
// Lactozilla: Shader functions
|
||||
static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i);
|
||||
static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
|
||||
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i);
|
||||
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
|
||||
|
||||
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
@@ -719,7 +717,7 @@ static boolean GLFramebuffer_CheckExt(void)
|
||||
return false;
|
||||
|
||||
// check if all needed gl extensions are available
|
||||
return (isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
|
||||
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -791,7 +789,7 @@ void SetupGLFunc4(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
boolean GL_InitShaders(void)
|
||||
{
|
||||
if (!pglUseProgram)
|
||||
return false;
|
||||
@@ -799,7 +797,7 @@ EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER);
|
||||
gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER);
|
||||
|
||||
if (!Shader_CompileProgram(&gl_fallback_shader, -1))
|
||||
if (!GL_Shader_CompileProgram(&gl_fallback_shader, -1))
|
||||
{
|
||||
GL_MSG_Error("Failed to compile the fallback shader program!\n");
|
||||
return false;
|
||||
@@ -808,7 +806,7 @@ EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
return true;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage)
|
||||
{
|
||||
gl_shader_t *shader;
|
||||
|
||||
@@ -833,12 +831,12 @@ EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
||||
#undef LOADSHADER
|
||||
}
|
||||
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
boolean GL_CompileShader(int slot)
|
||||
{
|
||||
if (slot < 0 || slot >= HWR_MAXSHADERS)
|
||||
I_Error("CompileShader: Invalid slot %d", slot);
|
||||
|
||||
if (Shader_CompileProgram(&gl_shaders[slot], slot))
|
||||
if (GL_Shader_CompileProgram(&gl_shaders[slot], slot))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -854,7 +852,7 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
// Those are given to the uniforms.
|
||||
//
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value)
|
||||
{
|
||||
switch (info)
|
||||
{
|
||||
@@ -866,11 +864,11 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetShader) (int slot)
|
||||
void GL_SetShader(int slot)
|
||||
{
|
||||
if (slot == SHADER_NONE)
|
||||
{
|
||||
UnSetShader();
|
||||
GL_UnSetShader();
|
||||
return;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
@@ -897,7 +895,7 @@ EXPORT void HWRAPI(SetShader) (int slot)
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(UnSetShader) (void)
|
||||
void GL_UnSetShader(void)
|
||||
{
|
||||
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
{
|
||||
@@ -916,10 +914,10 @@ EXPORT void HWRAPI(UnSetShader) (void)
|
||||
// -----------------+
|
||||
// SetNoTexture : Disable texture
|
||||
// -----------------+
|
||||
static void SetNoTexture(void)
|
||||
static void GL_SetNoTexture(void)
|
||||
{
|
||||
// Disable texture.
|
||||
if (tex_downloaded != NOTEXTURE_NUM)
|
||||
if (tex_downloaded != NOTEXTURE_NUM && !currently_batching)
|
||||
{
|
||||
if (NOTEXTURE_NUM == 0)
|
||||
pglGenTextures(1, &NOTEXTURE_NUM);
|
||||
@@ -928,7 +926,10 @@ static void SetNoTexture(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void GLPerspective(GLfloat fovy, GLfloat aspect)
|
||||
// -----------------+
|
||||
// Perspective :
|
||||
// -----------------+
|
||||
static void GL_Perspective(GLfloat fovy, GLfloat aspect)
|
||||
{
|
||||
GLfloat m[4][4] =
|
||||
{
|
||||
@@ -957,7 +958,7 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
|
||||
// -----------------+
|
||||
// SetModelView :
|
||||
// -----------------+
|
||||
void SetModelView(GLint w, GLint h)
|
||||
void GL_SetModelView(GLint w, GLint h)
|
||||
{
|
||||
//GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
|
||||
|
||||
@@ -969,7 +970,7 @@ void SetModelView(GLint w, GLint h)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
pglLoadIdentity();
|
||||
|
||||
GLPerspective(fov, ASPECT_RATIO);
|
||||
GL_Perspective(fov, ASPECT_RATIO);
|
||||
|
||||
// added for new coronas' code (without depth buffer)
|
||||
pglGetIntegerv(GL_VIEWPORT, viewport);
|
||||
@@ -979,7 +980,7 @@ void SetModelView(GLint w, GLint h)
|
||||
// -----------------+
|
||||
// SetStates : Set permanent states
|
||||
// -----------------+
|
||||
void SetStates(void)
|
||||
void GL_SetStates(void)
|
||||
{
|
||||
pglEnable(GL_TEXTURE_2D); // two-dimensional texturing
|
||||
pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
@@ -999,10 +1000,10 @@ void SetStates(void)
|
||||
|
||||
// this set CurrentPolyFlags to the actual configuration
|
||||
CurrentPolyFlags = 0xffffffff;
|
||||
SetBlend(0);
|
||||
GL_SetBlend(0);
|
||||
|
||||
tex_downloaded = 0;
|
||||
SetNoTexture();
|
||||
GL_SetNoTexture();
|
||||
|
||||
pglPolygonOffset(-1.0f, -1.0f);
|
||||
|
||||
@@ -1015,7 +1016,7 @@ void SetStates(void)
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
@@ -1047,7 +1048,7 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
static void GLFramebuffer_GenerateAttachments(void)
|
||||
static void GL_Framebuffer_GenerateAttachments(void)
|
||||
{
|
||||
if (!supportFBO || !UseScreenFBO())
|
||||
return;
|
||||
@@ -1079,7 +1080,7 @@ static void GLFramebuffer_GenerateAttachments(void)
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
|
||||
|
||||
// Clear the renderbuffer
|
||||
ClearBuffer(true, true, true, NULL);
|
||||
GL_ClearBuffer(true, true, true, NULL);
|
||||
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
@@ -1090,7 +1091,7 @@ static void GLFramebuffer_GenerateAttachments(void)
|
||||
fboinit = true;
|
||||
}
|
||||
|
||||
void GLFramebuffer_DeleteAttachments(void)
|
||||
void GL_Framebuffer_DeleteAttachments(void)
|
||||
{
|
||||
if (!supportFBO || fboinit == false)
|
||||
return;
|
||||
@@ -1113,7 +1114,7 @@ void GLFramebuffer_DeleteAttachments(void)
|
||||
fboinit = false;
|
||||
}
|
||||
|
||||
static void GLFramebuffer_Generate(void)
|
||||
static void GL_Framebuffer_Generate(void)
|
||||
{
|
||||
if (!supportFBO || !UseScreenFBO())
|
||||
return;
|
||||
@@ -1123,10 +1124,10 @@ static void GLFramebuffer_Generate(void)
|
||||
pglGenFramebuffers(1, &FramebufferObject);
|
||||
|
||||
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
GL_Framebuffer_GenerateAttachments();
|
||||
}
|
||||
|
||||
static void GLFramebuffer_Delete(void)
|
||||
static void GL_Framebuffer_Delete(void)
|
||||
{
|
||||
if (!supportFBO || fboinit == false)
|
||||
return;
|
||||
@@ -1134,11 +1135,11 @@ static void GLFramebuffer_Delete(void)
|
||||
if (FramebufferObject)
|
||||
pglDeleteFramebuffers(1, &FramebufferObject);
|
||||
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
FramebufferObject = 0;
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Unbind(void)
|
||||
inline void GL_Framebuffer_Unbind(void)
|
||||
{
|
||||
if (!supportFBO || fboinit == false)
|
||||
return;
|
||||
@@ -1150,21 +1151,21 @@ inline void GLFramebuffer_Unbind(void)
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
inline void GLFramebuffer_Enable(void)
|
||||
inline void GL_Framebuffer_Enable(void)
|
||||
{
|
||||
if (!supportFBO || !UseScreenFBO())
|
||||
return;
|
||||
|
||||
if (FramebufferObject == 0)
|
||||
GLFramebuffer_Generate();
|
||||
GL_Framebuffer_Generate();
|
||||
else if (FramebufferTexture == 0 || RenderbufferObject == 0)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
GL_Framebuffer_GenerateAttachments();
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
|
||||
}
|
||||
|
||||
void GLFramebuffer_Disable(void)
|
||||
void GL_Framebuffer_Disable(void)
|
||||
{
|
||||
if (!supportFBO || fboinit == false)
|
||||
return;
|
||||
@@ -1175,7 +1176,7 @@ void GLFramebuffer_Disable(void)
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
GLFramebuffer_Delete();
|
||||
GL_Framebuffer_Delete();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1183,7 +1184,7 @@ void GLFramebuffer_Disable(void)
|
||||
// Flush : flush OpenGL textures
|
||||
// : Clear list of downloaded mipmaps
|
||||
// -----------------+
|
||||
void Flush(void)
|
||||
void GL_Flush(void)
|
||||
{
|
||||
while (TexCacheHead)
|
||||
{
|
||||
@@ -1215,7 +1216,7 @@ void Flush(void)
|
||||
// isExtAvailable : Look if an OpenGL extension is available
|
||||
// Returns : true if extension available
|
||||
// -----------------+
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start)
|
||||
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start)
|
||||
{
|
||||
GLubyte *where, *terminator;
|
||||
|
||||
@@ -1242,34 +1243,25 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
|
||||
// Init : Initialise the OpenGL interface API
|
||||
// Returns :
|
||||
// -----------------+
|
||||
EXPORT boolean HWRAPI(Init) (void)
|
||||
boolean GL_Init (void)
|
||||
{
|
||||
return LoadGL();
|
||||
return SetupGLfunc();
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// SetupGLInfo : Retreive and store currently loaded OpenGL version
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetupGLInfo) (void)
|
||||
void SetupGLInfo(void)
|
||||
{
|
||||
const GLubyte *versionGL = pglGetString(GL_VERSION);
|
||||
CONS_Printf("Loaded OpenGL version %s\n", (const char*)versionGL);
|
||||
sscanf((const char*)versionGL, "%d.%d", &majorGL, &minorGL);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// ClearMipMapCache : Flush OpenGL textures from memory
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
|
||||
// Writes screen texture tex into dst_data.
|
||||
// Pixel format is 24-bit RGB. Row order is top to bottom.
|
||||
// Dimensions are screen_width * screen_height.
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
void GL_ReadScreenTexture(int tex, UINT16 *dst_data)
|
||||
{
|
||||
INT32 i;
|
||||
int dst_stride = screen_width * 3; // stride between rows of image data
|
||||
@@ -1282,11 +1274,11 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
// and draw generic2 back after reading the framebuffer.
|
||||
// this hack is for some reason **much** faster than the simple solution of using glGetTexImage.
|
||||
if (tex != HWD_SCREENTEXTURE_GENERIC2)
|
||||
DrawScreenTexture(tex, NULL, 0);
|
||||
GL_DrawScreenTexture(tex, NULL, 0);
|
||||
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, dst_data);
|
||||
if (tex != HWD_SCREENTEXTURE_GENERIC2)
|
||||
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
// Flip image upside down.
|
||||
// In other words, convert OpenGL's "bottom->top" row order into "top->bottom".
|
||||
for(i = 0; i < screen_height/2; i++)
|
||||
@@ -1300,10 +1292,24 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
free(row);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Changes the current texture palette
|
||||
// -----------------+
|
||||
void GL_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, palette, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, palette, palsize);
|
||||
GL_Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// GClipRect : Defines the 2D hardware clipping window
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
{
|
||||
//GL_DBG_Printf("GClipRect(%d, %d, %d, %d)\n", minx, miny, maxx, maxy);
|
||||
|
||||
@@ -1314,7 +1320,7 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
|
||||
//pglScissor(minx, screen_height-maxy, maxx-minx, maxy-miny);
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
GLPerspective(fov, ASPECT_RATIO);
|
||||
GL_Perspective(fov, ASPECT_RATIO);
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
|
||||
// added for new coronas' code (without depth buffer)
|
||||
@@ -1326,10 +1332,7 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
|
||||
// -----------------+
|
||||
// ClearBuffer : Clear the color/alpha/depth buffer(s)
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
FBOOLEAN DepthMask,
|
||||
FBOOLEAN StencilMask,
|
||||
FRGBAFloat * ClearColor)
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor)
|
||||
{
|
||||
//GL_DBG_Printf("ClearBuffer(%d)\n", alpha);
|
||||
GLbitfield ClearMask = 0;
|
||||
@@ -1351,7 +1354,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
ClearMask |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
GL_SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
|
||||
if (StencilMask)
|
||||
ClearMask |= GL_STENCIL_BUFFER_BIT;// looks like sometimes stencil buffer needs clearing? had a problem with random black screens
|
||||
@@ -1364,9 +1367,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
// -----------------+
|
||||
// HWRAPI Draw2DLine: Render a 2D line
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
|
||||
F2DCoord * v2,
|
||||
RGBA_t Color)
|
||||
void GL_Draw2DLine(F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
|
||||
{
|
||||
//GL_DBG_Printf("DrawLine(): %f %f, %f %f\n", v1->x, v1->y, v2->x, v2->y);
|
||||
GLfloat p[12];
|
||||
@@ -1413,7 +1414,7 @@ static void Clamp2D(GLenum pname)
|
||||
// -----------------+
|
||||
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
|
||||
// is it faster when pixels are discarded ?
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
||||
void GL_SetBlend(FBITFIELD PolyFlags)
|
||||
{
|
||||
FBITFIELD Xor;
|
||||
Xor = CurrentPolyFlags^PolyFlags;
|
||||
@@ -1540,12 +1541,12 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
||||
}
|
||||
}
|
||||
if (PolyFlags & PF_NoTexture)
|
||||
SetNoTexture();
|
||||
GL_SetNoTexture();
|
||||
}
|
||||
CurrentPolyFlags = PolyFlags;
|
||||
}
|
||||
|
||||
static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
size_t size = pTexInfo->width * pTexInfo->height;
|
||||
if (size > textureBufferSize)
|
||||
@@ -1560,7 +1561,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
@@ -1572,7 +1573,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
|
||||
const GLvoid *ptex = NULL;
|
||||
RGBA_t *tex = NULL;
|
||||
|
||||
|
||||
// Generate a new texture name.
|
||||
if (!num)
|
||||
{
|
||||
@@ -1585,7 +1586,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
|
||||
if ((pTexInfo->format == GL_TEXFMT_P_8) || (pTexInfo->format == GL_TEXFMT_AP_88))
|
||||
{
|
||||
AllocTextureBuffer(pTexInfo);
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
|
||||
for (j = 0; j < h; j++)
|
||||
@@ -1627,7 +1628,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
|
||||
{
|
||||
AllocTextureBuffer(pTexInfo);
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
|
||||
for (j = 0; j < h; j++)
|
||||
@@ -1645,7 +1646,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
else if (pTexInfo->format == GL_TEXFMT_ALPHA_8) // Used for fade masks
|
||||
{
|
||||
AllocTextureBuffer(pTexInfo);
|
||||
GL_AllocTextureBuffer(pTexInfo);
|
||||
ptex = tex = textureBuffer;
|
||||
|
||||
for (j = 0; j < h; j++)
|
||||
@@ -1765,18 +1766,19 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
SetNoTexture();
|
||||
GL_SetNoTexture();
|
||||
return;
|
||||
}
|
||||
else if (pTexInfo->downloaded)
|
||||
{
|
||||
if (pTexInfo->downloaded != tex_downloaded)
|
||||
{
|
||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||
if (!currently_batching)
|
||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||
tex_downloaded = pTexInfo->downloaded;
|
||||
}
|
||||
}
|
||||
@@ -1784,7 +1786,7 @@ EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *newTex = calloc(1, sizeof (*newTex));
|
||||
|
||||
UpdateTexture(pTexInfo);
|
||||
GL_UpdateTexture(pTexInfo);
|
||||
|
||||
newTex->texture = pTexInfo;
|
||||
newTex->downloaded = (UINT32)pTexInfo->downloaded;
|
||||
@@ -1804,7 +1806,7 @@ EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
}
|
||||
|
||||
static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
|
||||
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
|
||||
{
|
||||
gl_shader_t *shader = gl_shaderstate.current;
|
||||
|
||||
@@ -1869,7 +1871,7 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
}
|
||||
}
|
||||
|
||||
static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
{
|
||||
GLuint gl_vertShader = 0;
|
||||
GLuint gl_fragShader = 0;
|
||||
@@ -2014,13 +2016,13 @@ static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
// code that is common between DrawPolygon and DrawIndexedTriangles
|
||||
// DrawScreenTexture also can use this function for fancier screen texture drawing
|
||||
// the corona thing is there too, i have no idea if that stuff works with DrawIndexedTriangles and batching
|
||||
static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
static void GL_PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
{
|
||||
static GLRGBAFloat poly = {0,0,0,0};
|
||||
static GLRGBAFloat tint = {0,0,0,0};
|
||||
static GLRGBAFloat fade = {0,0,0,0};
|
||||
|
||||
SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
GL_SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
|
||||
if (pSurf)
|
||||
{
|
||||
@@ -2060,15 +2062,15 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
}
|
||||
}
|
||||
|
||||
Shader_SetUniforms(pSurf, &poly, &tint, &fade);
|
||||
GL_Shader_SetUniforms(pSurf, &poly, &tint, &fade);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
GL_PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
|
||||
@@ -2084,9 +2086,9 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
GL_PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
|
||||
@@ -2102,11 +2104,11 @@ static const boolean gl_ext_arb_vertex_buffer_object = true;
|
||||
#define sky_vbo_u (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->u : &sky->data[0].u)
|
||||
#define sky_vbo_r (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->r : &sky->data[0].r)
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky)
|
||||
void GL_RenderSkyDome(gl_sky_t *sky)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
Shader_SetUniforms(NULL, NULL, NULL, NULL);
|
||||
GL_Shader_SetUniforms(NULL, NULL, NULL, NULL);
|
||||
|
||||
// Build the sky dome! Yes!
|
||||
if (sky->rebuild)
|
||||
@@ -2189,7 +2191,7 @@ EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky)
|
||||
// ==========================================================================
|
||||
//
|
||||
// ==========================================================================
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
|
||||
{
|
||||
switch (IdState)
|
||||
{
|
||||
@@ -2237,7 +2239,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
min_filter = GL_LINEAR;
|
||||
}
|
||||
|
||||
Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
GL_Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
break;
|
||||
|
||||
case HWD_SET_MSAA:
|
||||
@@ -2252,7 +2254,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
case HWD_SET_TEXTUREANISOTROPICMODE:
|
||||
anisotropic_filter = min(Value,maximumAnisotropy);
|
||||
if (maximumAnisotropy)
|
||||
Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
GL_Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
break;
|
||||
|
||||
case HWD_SET_SCREEN_TEXTURES:
|
||||
@@ -2338,7 +2340,7 @@ static size_t lerpTinyBufferSize = 0;
|
||||
|
||||
// Static temporary buffer for doing frame interpolation
|
||||
// 'size' is the vertex size
|
||||
static void AllocLerpBuffer(size_t size)
|
||||
static void GL_AllocLerpBuffer(size_t size)
|
||||
{
|
||||
if (lerpBufferSize >= size)
|
||||
return;
|
||||
@@ -2356,7 +2358,7 @@ static void AllocLerpBuffer(size_t size)
|
||||
|
||||
// Static temporary buffer for doing frame interpolation
|
||||
// 'size' is the vertex size
|
||||
static void AllocLerpTinyBuffer(size_t size)
|
||||
static void GL_AllocLerpTinyBuffer(size_t size)
|
||||
{
|
||||
if (lerpTinyBufferSize >= size)
|
||||
return;
|
||||
@@ -2380,7 +2382,7 @@ static void AllocLerpTinyBuffer(size_t size)
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#endif
|
||||
|
||||
static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
|
||||
static void GL_CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
|
||||
{
|
||||
int bufferSize = sizeof(vbo64_t)*mesh->numTriangles * 3;
|
||||
vbo64_t *buffer = (vbo64_t*)malloc(bufferSize);
|
||||
@@ -2448,7 +2450,7 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
static void GL_CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
{
|
||||
int bufferSize = sizeof(vbotiny_t)*mesh->numTriangles * 3;
|
||||
vbotiny_t *buffer = (vbotiny_t*)malloc(bufferSize);
|
||||
@@ -2493,9 +2495,10 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
void GL_CreateModelVBOs(model_t *model)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < model->numMeshes; i++)
|
||||
{
|
||||
mesh_t *mesh = &model->meshes[i];
|
||||
@@ -2509,7 +2512,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
if (frame->vboID)
|
||||
pglDeleteBuffers(1, &frame->vboID);
|
||||
frame->vboID = 0;
|
||||
CreateModelVBO(mesh, frame);
|
||||
GL_CreateModelVBO(mesh, frame);
|
||||
}
|
||||
}
|
||||
else if (mesh->tinyframes)
|
||||
@@ -2521,7 +2524,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
if (frame->vboID)
|
||||
pglDeleteBuffers(1, &frame->vboID);
|
||||
frame->vboID = 0;
|
||||
CreateModelVBOTiny(mesh, frame);
|
||||
GL_CreateModelVBOTiny(mesh, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2529,7 +2532,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
|
||||
#define BUFFER_OFFSET(i) ((char*)(i))
|
||||
|
||||
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
static GLRGBAFloat poly = {0,0,0,0};
|
||||
static GLRGBAFloat tint = {0,0,0,0};
|
||||
@@ -2568,9 +2571,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
poly.alpha = byte2float[Surface->PolyColor.s.alpha];
|
||||
|
||||
if (poly.alpha < 1)
|
||||
SetBlend(PF_Translucent|PF_Modulated);
|
||||
GL_SetBlend(PF_Translucent|PF_Modulated);
|
||||
else
|
||||
SetBlend(PF_Masked|PF_Modulated|PF_Occlude);
|
||||
GL_SetBlend(PF_Masked|PF_Modulated|PF_Occlude);
|
||||
|
||||
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
|
||||
|
||||
@@ -2592,7 +2595,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
lt_downloaded = Surface->LightTableId;
|
||||
}
|
||||
|
||||
Shader_SetUniforms(Surface, &poly, &tint, &fade);
|
||||
GL_Shader_SetUniforms(Surface, &poly, &tint, &fade);
|
||||
|
||||
pglEnable(GL_CULL_FACE);
|
||||
pglEnable(GL_NORMALIZE);
|
||||
@@ -2688,7 +2691,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
int j = 0;
|
||||
|
||||
// Dangit, I soooo want to do this in a GLSL shader...
|
||||
AllocLerpTinyBuffer(mesh->numVertices * sizeof(short) * 3);
|
||||
GL_AllocLerpTinyBuffer(mesh->numVertices * sizeof(short) * 3);
|
||||
vertPtr = vertTinyBuffer;
|
||||
normPtr = normTinyBuffer;
|
||||
|
||||
@@ -2731,7 +2734,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
int j = 0;
|
||||
|
||||
// Dangit, I soooo want to do this in a GLSL shader...
|
||||
AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3);
|
||||
GL_AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3);
|
||||
vertPtr = vertBuffer;
|
||||
normPtr = normBuffer;
|
||||
|
||||
@@ -2757,18 +2760,10 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
pglDisable(GL_NORMALIZE);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWRAPI DrawModel : Draw a model
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// SetTransform :
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
void GL_SetTransform(FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
GLdouble used_fov;
|
||||
@@ -2828,10 +2823,10 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
if (special_splitscreen)
|
||||
{
|
||||
used_fov = (float)(atan(tan(used_fov * M_PIl / 360) * 0.8) * 360 / M_PIl);
|
||||
GLPerspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||
GL_Perspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
GLPerspective((GLfloat)used_fov, ASPECT_RATIO);
|
||||
GL_Perspective((GLfloat)used_fov, ASPECT_RATIO);
|
||||
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
@@ -2839,7 +2834,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
INT32 GL_GetTextureUsed(void)
|
||||
{
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
@@ -2864,7 +2859,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
return res;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
|
||||
{
|
||||
INT32 x, y;
|
||||
float float_x, float_y, float_nextx, float_nexty;
|
||||
@@ -2901,9 +2896,9 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
for(x=0;x<SCREENVERTS-1;x++)
|
||||
for(x = 0; x < SCREENVERTS-1;x ++)
|
||||
{
|
||||
for(y=0;y<SCREENVERTS-1;y++)
|
||||
for(y = 0; y < SCREENVERTS-1; y++)
|
||||
{
|
||||
float stCoords[8];
|
||||
float vertCoords[12];
|
||||
@@ -2952,13 +2947,13 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
|
||||
// Sryder: This needs to be called whenever the screen changes resolution in order to reset the screen textures to use
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
void GL_FlushScreenTextures(void)
|
||||
{
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
memset(screenTextures, 0 , sizeof(screenTextures));
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
{
|
||||
float xfix, yfix;
|
||||
INT32 texsize = 512;
|
||||
@@ -2999,7 +2994,7 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
|
||||
GL_PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
|
||||
if (!surf)
|
||||
pglColor4ubv(white);
|
||||
|
||||
@@ -3012,7 +3007,7 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
||||
|
||||
|
||||
// Do screen fades!
|
||||
EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
float xfix, yfix;
|
||||
@@ -3061,7 +3056,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
SetBlend(PF_Modulated|PF_NoDepthTest);
|
||||
GL_SetBlend(PF_Modulated|PF_NoDepthTest);
|
||||
pglEnable(GL_TEXTURE_2D);
|
||||
|
||||
// Draw the original screen
|
||||
@@ -3071,7 +3066,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
|
||||
// Draw the end screen that fades in
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
@@ -3103,7 +3098,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
tex_downloaded = screenTextures[wipeEnd];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
int tex = HWD_SCREENTEXTURE_VHS;
|
||||
@@ -3131,8 +3126,8 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(tex);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_MakeScreenTexture(tex);
|
||||
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
for (i = 0; i < 1; i += 2.f/vid.height)
|
||||
@@ -3155,7 +3150,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
MakeScreenTexture(tex);
|
||||
GL_MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
@@ -3184,7 +3179,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
MakeScreenTexture(tex);
|
||||
GL_MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
@@ -3210,7 +3205,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Create a texture from the screen.
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
void GL_MakeScreenTexture(int tex)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
boolean firstTime = (screenTextures[tex] == 0);
|
||||
@@ -3241,7 +3236,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, boolean useshader)
|
||||
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3303,11 +3298,11 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, b
|
||||
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
SetBlend(PF_NoDepthTest);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
GL_SetBlend(PF_NoDepthTest);
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
|
||||
if (useshader)
|
||||
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader
|
||||
|
||||
@@ -3324,7 +3319,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, b
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
||||
void GL_SetPaletteLookup(UINT8 *lut)
|
||||
{
|
||||
GLenum internalFormat;
|
||||
if (gl_version[0] == '1' || gl_version[0] == '2')
|
||||
@@ -3351,7 +3346,7 @@ EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable)
|
||||
{
|
||||
LTListItem *item = malloc(sizeof(LTListItem));
|
||||
if (!LightTablesTail)
|
||||
@@ -3377,7 +3372,7 @@ EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
||||
}
|
||||
|
||||
// Delete light table textures, ids given before become invalid and must not be used.
|
||||
EXPORT void HWRAPI(ClearLightTables)(void)
|
||||
void GL_ClearLightTables(void)
|
||||
{
|
||||
while (LightTablesHead)
|
||||
{
|
||||
@@ -3394,7 +3389,7 @@ EXPORT void HWRAPI(ClearLightTables)(void)
|
||||
}
|
||||
|
||||
// This palette is used for the palette rendering postprocessing step.
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette)
|
||||
void GL_SetScreenPalette(RGBA_t *palette)
|
||||
{
|
||||
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gpu.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
// ==========================================================================
|
||||
@@ -65,14 +65,15 @@ extern FILE *gllogstream;
|
||||
// PROTOS
|
||||
// ==========================================================================
|
||||
|
||||
boolean LoadGL(void);
|
||||
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
|
||||
|
||||
void *GetGLFunc(const char *proc);
|
||||
boolean SetupGLfunc(void);
|
||||
void SetupGLFunc4(void);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
void GL_Flush(void);
|
||||
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void GL_SetModelView(GLint w, GLint h);
|
||||
void GL_SetStates(void);
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
@@ -101,11 +102,11 @@ extern PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
void GL_Framebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
@@ -129,6 +130,8 @@ extern GLbyte screen_depth;
|
||||
extern GLint maximumAnisotropy;
|
||||
extern boolean supportMipMap;
|
||||
|
||||
extern struct GPURenderingAPI GLInterfaceAPI;
|
||||
|
||||
/** \brief OpenGL flags for video driver
|
||||
*/
|
||||
extern INT32 oglflags;
|
||||
|
||||
+1
-57
@@ -43,14 +43,6 @@
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "ogl_sdl.h"
|
||||
#ifdef STATIC_OPENGL
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "../hardware/hw3dsdrv.h"
|
||||
#endif
|
||||
@@ -73,55 +65,7 @@
|
||||
void *hwSym(const char *funcName,void *handle)
|
||||
{
|
||||
void *funcPointer = NULL;
|
||||
#ifdef HWRENDER
|
||||
if (0 == strcmp("SetTexturePalette", funcName))
|
||||
funcPointer = &OglSdlSetPalette;
|
||||
|
||||
GETFUNC(Init);
|
||||
GETFUNC(SetupGLInfo);
|
||||
GETFUNC(Draw2DLine);
|
||||
GETFUNC(DrawPolygon);
|
||||
GETFUNC(DrawIndexedTriangles);
|
||||
GETFUNC(SetBlend);
|
||||
GETFUNC(ClearBuffer);
|
||||
GETFUNC(SetTexture);
|
||||
GETFUNC(UpdateTexture);
|
||||
GETFUNC(DeleteTexture);
|
||||
GETFUNC(ReadScreenTexture);
|
||||
GETFUNC(GClipRect);
|
||||
GETFUNC(ClearMipMapCache);
|
||||
GETFUNC(SetSpecialState);
|
||||
GETFUNC(GetTextureUsed);
|
||||
GETFUNC(DrawModel);
|
||||
GETFUNC(CreateModelVBOs);
|
||||
GETFUNC(SetTransform);
|
||||
GETFUNC(PostImgRedraw);
|
||||
GETFUNC(FlushScreenTextures);
|
||||
GETFUNC(DoScreenWipe);
|
||||
GETFUNC(DrawScreenTexture);
|
||||
GETFUNC(MakeScreenTexture);
|
||||
GETFUNC(RenderVhsEffect);
|
||||
GETFUNC(DrawScreenFinalTexture);
|
||||
|
||||
GETFUNC(RenderSkyDome);
|
||||
|
||||
GETFUNC(InitShaders);
|
||||
GETFUNC(LoadShader);
|
||||
GETFUNC(CompileShader);
|
||||
GETFUNC(SetShader);
|
||||
GETFUNC(UnSetShader);
|
||||
|
||||
GETFUNC(SetShaderInfo);
|
||||
|
||||
GETFUNC(SetPaletteLookup);
|
||||
GETFUNC(CreateLightTable);
|
||||
GETFUNC(ClearLightTables);
|
||||
GETFUNC(SetScreenPalette);
|
||||
|
||||
#else //HWRENDER
|
||||
if (0 == strcmp("FinishUpdate", funcName))
|
||||
return funcPointer; //&FinishUpdate;
|
||||
#endif //!HWRENDER
|
||||
if (0) ;
|
||||
#ifdef STATIC3DS
|
||||
GETFUNC(Startup);
|
||||
GETFUNC(AddSfx);
|
||||
|
||||
+2
-44
@@ -79,7 +79,7 @@
|
||||
#include "../hu_stuff.h" // for chat_on
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "../hardware/r_opengl/r_opengl.h" //for supportFBO
|
||||
// For dynamic referencing of HW rendering functions
|
||||
#include "hwsym_sdl.h"
|
||||
@@ -2153,50 +2153,8 @@ void I_StartupGraphics(void)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnSetupGLInfo = hwSym("SetupGLInfo",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnDrawIndexedTriangles = hwSym("DrawIndexedTriangles",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnUpdateTexture = hwSym("UpdateTexture",NULL);
|
||||
HWD.pfnDeleteTexture = hwSym("DeleteTexture",NULL);
|
||||
HWD.pfnReadScreenTexture= hwSym("ReadScreenTexture",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetTexturePalette= hwSym("SetTexturePalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawScreenTexture= hwSym("DrawScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
vid.glstate = (VID_LoadOGLAPI() && GL_Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
|
||||
|
||||
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
|
||||
HWD.pfnInitShaders = hwSym("InitShaders",NULL);
|
||||
HWD.pfnLoadShader = hwSym("LoadShader",NULL);
|
||||
HWD.pfnCompileShader = hwSym("CompileShader",NULL);
|
||||
HWD.pfnSetShader = hwSym("SetShader",NULL);
|
||||
HWD.pfnUnSetShader = hwSym("UnSetShader",NULL);
|
||||
|
||||
HWD.pfnSetShaderInfo = hwSym("SetShaderInfo",NULL);
|
||||
|
||||
HWD.pfnSetPaletteLookup = hwSym("SetPaletteLookup",NULL);
|
||||
HWD.pfnCreateLightTable = hwSym("CreateLightTable",NULL);
|
||||
HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL);
|
||||
HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL);
|
||||
|
||||
vid.glstate = HWD.pfnInit() ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR; // let load the OpenGL library
|
||||
if (vid.glstate == VID_GL_LIBRARY_ERROR)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
|
||||
+22
-27
@@ -38,6 +38,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "ogl_sdl.h"
|
||||
#include "../i_system.h"
|
||||
#include "hwsym_sdl.h"
|
||||
@@ -93,7 +94,7 @@ void *GetGLFunc(const char *proc)
|
||||
return SDL_GL_GetProcAddress(proc);
|
||||
}
|
||||
|
||||
boolean LoadGL(void)
|
||||
boolean VID_LoadOGLAPI(void)
|
||||
{
|
||||
#ifndef STATIC_OPENGL
|
||||
const char *OGLLibname = NULL;
|
||||
@@ -110,7 +111,7 @@ boolean LoadGL(void)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return SetupGLfunc();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief The OglSdlSurface function
|
||||
@@ -176,7 +177,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
else
|
||||
supportMipMap = true;
|
||||
|
||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||
if (GL_isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
||||
else
|
||||
maximumAnisotropy = 1;
|
||||
@@ -196,18 +197,18 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
FlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
screen_width = (GLint)w;
|
||||
screen_height = (GLint)h;
|
||||
|
||||
SetModelView(w, h);
|
||||
SetStates();
|
||||
GL_SetModelView(w, h);
|
||||
GL_SetStates();
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
@@ -219,9 +220,9 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
}
|
||||
|
||||
if (UseScreenFBO())
|
||||
GLFramebuffer_Enable();
|
||||
GL_Framebuffer_Enable();
|
||||
else
|
||||
GLFramebuffer_Disable();
|
||||
GL_Framebuffer_Disable();
|
||||
#endif
|
||||
|
||||
if (!first_init)
|
||||
@@ -255,19 +256,24 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
GLFramebuffer_Unbind();
|
||||
{
|
||||
GL_Framebuffer_Unbind();
|
||||
}
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
//HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, sdlw, sdlh, true);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
GLFramebuffer_Enable();
|
||||
{
|
||||
GL_Framebuffer_Enable();
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
@@ -277,20 +283,9 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
#endif
|
||||
)
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = palette[i].s.red;
|
||||
myPaletteData[i].s.green = palette[i].s.green;
|
||||
myPaletteData[i].s.blue = palette[i].s.blue;
|
||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||
}
|
||||
Flush();
|
||||
//HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
//GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, realwidth, realheight);
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
||||
+1
-3
@@ -21,12 +21,10 @@
|
||||
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
boolean VID_LoadOGLAPI(void);
|
||||
|
||||
extern SDL_Renderer *renderer;
|
||||
extern SDL_GLContext sdlglcontext;
|
||||
extern Uint16 realwidth;
|
||||
extern Uint16 realheight;
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette);
|
||||
#endif
|
||||
Reference in new issue
Block a user