Murdered MiniGL (yes it's not a port, but we don't need it anymore anyway)

This commit is contained in:
Monster Iestyn 2017-09-30 17:00:37 +01:00
parent c448027312
commit 20709f55b5
6 changed files with 18 additions and 394 deletions

View file

@ -33,8 +33,6 @@
# compile all HW render and 3D sound DLLs for the set # compile all HW render and 3D sound DLLs for the set
# opengl_dll # opengl_dll
# Pure Mingw only, compile OpenGL HW render DLL # Pure Mingw only, compile OpenGL HW render DLL
# minigl_dll
# Pure Mingw only, compile MiniGL HW render DLL
# ds3d_dll # ds3d_dll
# Pure Mingw only, compile DirectX DirectSound HW sound DLL # Pure Mingw only, compile DirectX DirectSound HW sound DLL
# fmod_dll # fmod_dll
@ -570,7 +568,7 @@ else
dll : opengl_dll dll : opengl_dll
endif endif
ifdef MINGW ifdef MINGW
all_dll: opengl_dll minigl_dll ds3d_dll fmod_dll openal_dll all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
opengl_dll: $(BIN)/r_opengl.dll opengl_dll: $(BIN)/r_opengl.dll
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
@ -581,12 +579,6 @@ ifndef NOUPX
-$(UPX) $(UPX_OPTS) $@ -$(UPX) $(UPX_OPTS) $@
endif endif
minigl_dll: $(BIN)/r_minigl.dll
$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
-$(MKDIR) $(BIN)
@echo Linking R_MiniGL.dll...
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32
ds3d_dll: $(BIN)/s_ds3d.dll ds3d_dll: $(BIN)/s_ds3d.dll
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o $(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
@echo Linking S_DS3d.dll... @echo Linking S_DS3d.dll...
@ -725,14 +717,6 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@ $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
endif endif
ifndef NOHS ifndef NOHS

View file

@ -1,33 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief MiniGL API for Doom Legacy
// tell r_opengl.cpp to compile for MiniGL Drivers
#define MINI_GL_COMPATIBILITY
// tell r_opengl.cpp to compile for ATI Rage Pro OpenGL driver
//#define ATI_RAGE_PRO_COMPATIBILITY
#define DRIVER_STRING "HWRAPI Init(): SRB2 MiniGL renderer"
// Include this at end
#include "../r_opengl/r_opengl.c"
#include "../r_opengl/ogl_win.c"
// That's all ;-)
// Just, be sure to do the right changes in r_opengl.cpp

View file

@ -1,89 +0,0 @@
[Project]
FileName=r_minigl.dev
Name=r_minigl
Ver=1
IsCpp=1
Type=3
Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-DUSE_WGL_SWAP_@@_-Os_@@_-fomit-frame-pointer_@@_
CppCompiler=
Includes=
Linker=--def ../r_mingw.def_@@_-lgdi32_@@_
Libs=
UnitCount=4
Folders=
ObjFiles=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Icon=
ExeOutput=C:\srb2demo2
ObjectOutput=..\..\..\objs\Mingw\r_minigl
OverrideOutput=1
OverrideOutputName=r_minigl.dll
HostApplication=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=00000000000000000111d0
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=..\r_opengl\ogl_win.c
Folder=
Compile=0
CompileCpp=0
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c ogl_win.c -o ../../../objs/Mingw/r_minigl/ogl_win.o $(CFLAGS)
[Unit2]
FileName=..\r_opengl\r_opengl.c
Folder=
Compile=0
CompileCpp=0
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c r_opengl.c -o ../../../objs/Mingw/r_minigl/r_opengl.o $(CFLAGS)
[Unit3]
FileName=..\r_opengl\r_opengl.h
Folder=
Compile=1
CompileCpp=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=0.1
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=r_opengl.exe
ProductName=r_opengl
ProductVersion=0.1
AutoIncBuildNr=0
[Unit4]
FileName=r_minigl.c
CompileCpp=0
Folder=r_minigl
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c r_minigl.c -o ../../../objs/Mingw/r_minigl/r_minigl.o $(CFLAGS)

View file

@ -1,103 +0,0 @@
# Microsoft Developer Studio Project File - Name="r_minigl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=r_minigl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "r_minigl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "r_minigl.mak" CFG="r_minigl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "r_minigl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "r_minigl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "r_minigl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "..\..\..\objs\Release"
# PROP BASE Intermediate_Dir "..\..\..\objs\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\bin\VC\Release\r_minigl"
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\r_minigl"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x80c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 user32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\r_minigl.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\r_minigl.dll"
# SUBTRACT LINK32 /pdb:none /debug
!ELSEIF "$(CFG)" == "r_minigl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "..\..\..\objs\Debug"
# PROP BASE Intermediate_Dir "..\..\..\objs\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\bin\VC\Debug\r_minigl"
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\r_minigl"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x80c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ouser32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\r_minigl.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\r_minigl.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "r_minigl - Win32 Release"
# Name "r_minigl - Win32 Debug"
# Begin Source File
SOURCE=.\r_minigl.c
# End Source File
# Begin Source File
SOURCE=..\r_opengl\r_opengl.h
# End Source File
# End Target
# End Project

View file

@ -90,11 +90,9 @@ static FTransform md2_transform;
const GLubyte *gl_extensions = NULL; const GLubyte *gl_extensions = NULL;
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-) //Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
#ifndef MINI_GL_COMPATIBILITY
static GLdouble modelMatrix[16]; static GLdouble modelMatrix[16];
static GLdouble projMatrix[16]; static GLdouble projMatrix[16];
static GLint viewport[4]; static GLint viewport[4];
#endif
#ifdef USE_PALETTED_TEXTURE #ifdef USE_PALETTED_TEXTURE
@ -154,9 +152,7 @@ float byteasfloat(UINT8 fbyte)
static I_Error_t I_Error_GL = NULL; static I_Error_t I_Error_GL = NULL;
#ifndef MINI_GL_COMPATIBILITY
static boolean gl13 = false; // whether we can use opengl 1.3 functions static boolean gl13 = false; // whether we can use opengl 1.3 functions
#endif
// -----------------+ // -----------------+
@ -194,9 +190,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglScissor glScissor #define pglScissor glScissor
#define pglEnable glEnable #define pglEnable glEnable
#define pglDisable glDisable #define pglDisable glDisable
#ifndef MINI_GL_COMPATIBILITY
#define pglGetDoublev glGetDoublev #define pglGetDoublev glGetDoublev
#endif
//glGetIntegerv //glGetIntegerv
//glGetString //glGetString
@ -212,11 +206,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglPushMatrix glPushMatrix #define pglPushMatrix glPushMatrix
#define pglPopMatrix glPopMatrix #define pglPopMatrix glPopMatrix
#define pglLoadIdentity glLoadIdentity #define pglLoadIdentity glLoadIdentity
#ifdef MINI_GL_COMPATIBILITY
#define pglMultMatrixf glMultMatrixf
#else
#define pglMultMatrixd glMultMatrixd #define pglMultMatrixd glMultMatrixd
#endif
#define pglRotatef glRotatef #define pglRotatef glRotatef
#define pglScalef glScalef #define pglScalef glScalef
#define pglTranslatef glTranslatef #define pglTranslatef glTranslatef
@ -281,10 +271,8 @@ typedef void (APIENTRY * PFNglEnable) (GLenum cap);
static PFNglEnable pglEnable; static PFNglEnable pglEnable;
typedef void (APIENTRY * PFNglDisable) (GLenum cap); typedef void (APIENTRY * PFNglDisable) (GLenum cap);
static PFNglDisable pglDisable; static PFNglDisable pglDisable;
#ifndef MINI_GL_COMPATIBILITY
typedef void (APIENTRY * PFNglGetDoublev) (GLenum pname, GLdouble *params); typedef void (APIENTRY * PFNglGetDoublev) (GLenum pname, GLdouble *params);
static PFNglGetDoublev pglGetDoublev; static PFNglGetDoublev pglGetDoublev;
#endif
//glGetIntegerv //glGetIntegerv
//glGetString //glGetString
@ -309,13 +297,8 @@ typedef void (APIENTRY * PFNglPopMatrix) (void);
static PFNglPopMatrix pglPopMatrix; static PFNglPopMatrix pglPopMatrix;
typedef void (APIENTRY * PFNglLoadIdentity) (void); typedef void (APIENTRY * PFNglLoadIdentity) (void);
static PFNglLoadIdentity pglLoadIdentity; static PFNglLoadIdentity pglLoadIdentity;
#ifdef MINI_GL_COMPATIBILITY
typedef void (APIENTRY * PFNglMultMatrixf) (const GLfloat *m);
static PFNglMultMatrixf pglMultMatrixf;
#else
typedef void (APIENTRY * PFNglMultMatrixd) (const GLdouble *m); typedef void (APIENTRY * PFNglMultMatrixd) (const GLdouble *m);
static PFNglMultMatrixd pglMultMatrixd; static PFNglMultMatrixd pglMultMatrixd;
#endif
typedef void (APIENTRY * PFNglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRY * PFNglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
static PFNglRotatef pglRotatef; static PFNglRotatef pglRotatef;
typedef void (APIENTRY * PFNglScalef) (GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRY * PFNglScalef) (GLfloat x, GLfloat y, GLfloat z);
@ -383,15 +366,12 @@ static PFNglCopyTexImage2D pglCopyTexImage2D;
typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
static PFNgluBuild2DMipmaps pgluBuild2DMipmaps; static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
#ifndef MINI_GL_COMPATIBILITY
/* 1.3 functions for multitexturing */ /* 1.3 functions for multitexturing */
typedef void (APIENTRY *PFNglActiveTexture) (GLenum); typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
static PFNglActiveTexture pglActiveTexture; static PFNglActiveTexture pglActiveTexture;
typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat); typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
static PFNglMultiTexCoord2f pglMultiTexCoord2f; static PFNglMultiTexCoord2f pglMultiTexCoord2f;
#endif
#ifndef MINI_GL_COMPATIBILITY
/* 1.2 Parms */ /* 1.2 Parms */
/* GL_CLAMP_TO_EDGE_EXT */ /* GL_CLAMP_TO_EDGE_EXT */
#ifndef GL_CLAMP_TO_EDGE #ifndef GL_CLAMP_TO_EDGE
@ -412,14 +392,6 @@ static PFNglMultiTexCoord2f pglMultiTexCoord2f;
#define GL_TEXTURE1 0x84C1 #define GL_TEXTURE1 0x84C1
#endif #endif
#endif
#ifdef MINI_GL_COMPATIBILITY
#undef GL_CLAMP_TO_EDGE
#undef GL_TEXTURE_MIN_LOD
#undef GL_TEXTURE_MAX_LOD
#endif
boolean SetupGLfunc(void) boolean SetupGLfunc(void)
{ {
#ifndef STATIC_OPENGL #ifndef STATIC_OPENGL
@ -442,9 +414,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglScissor , glScissor) GETOPENGLFUNC(pglScissor , glScissor)
GETOPENGLFUNC(pglEnable , glEnable) GETOPENGLFUNC(pglEnable , glEnable)
GETOPENGLFUNC(pglDisable , glDisable) GETOPENGLFUNC(pglDisable , glDisable)
#ifndef MINI_GL_COMPATIBILITY
GETOPENGLFUNC(pglGetDoublev , glGetDoublev) GETOPENGLFUNC(pglGetDoublev , glGetDoublev)
#endif
GETOPENGLFUNC(pglGetIntegerv , glGetIntegerv) GETOPENGLFUNC(pglGetIntegerv , glGetIntegerv)
GETOPENGLFUNC(pglGetString , glGetString) GETOPENGLFUNC(pglGetString , glGetString)
@ -458,11 +428,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglPushMatrix , glPushMatrix) GETOPENGLFUNC(pglPushMatrix , glPushMatrix)
GETOPENGLFUNC(pglPopMatrix , glPopMatrix) GETOPENGLFUNC(pglPopMatrix , glPopMatrix)
GETOPENGLFUNC(pglLoadIdentity , glLoadIdentity) GETOPENGLFUNC(pglLoadIdentity , glLoadIdentity)
#ifdef MINI_GL_COMPATIBILITY
GETOPENGLFUNC(pglMultMatrixf , glMultMatrixf)
#else
GETOPENGLFUNC(pglMultMatrixd , glMultMatrixd) GETOPENGLFUNC(pglMultMatrixd , glMultMatrixd)
#endif
GETOPENGLFUNC(pglRotatef , glRotatef) GETOPENGLFUNC(pglRotatef , glRotatef)
GETOPENGLFUNC(pglScalef , glScalef) GETOPENGLFUNC(pglScalef , glScalef)
GETOPENGLFUNC(pglTranslatef , glTranslatef) GETOPENGLFUNC(pglTranslatef , glTranslatef)
@ -506,9 +472,6 @@ boolean SetupGLfunc(void)
// This has to be done after the context is created so the version number can be obtained // This has to be done after the context is created so the version number can be obtained
boolean SetupGLFunc13(void) boolean SetupGLFunc13(void)
{ {
#ifdef MINI_GL_COMPATIBILITY
return false;
#else
const GLubyte *version = pglGetString(GL_VERSION); const GLubyte *version = pglGetString(GL_VERSION);
int glmajor, glminor; int glmajor, glminor;
@ -544,7 +507,6 @@ boolean SetupGLFunc13(void)
else else
DBG_Printf("GL_ARB_multitexture support: disabled\n"); DBG_Printf("GL_ARB_multitexture support: disabled\n");
return true; return true;
#endif
} }
// -----------------+ // -----------------+
@ -562,11 +524,7 @@ static void SetNoTexture(void)
static void GLPerspective(GLdouble fovy, GLdouble aspect) static void GLPerspective(GLdouble fovy, GLdouble aspect)
{ {
#ifdef MINI_GL_COMPATIBILITY
GLfloat m[4][4] =
#else
GLdouble m[4][4] = GLdouble m[4][4] =
#endif
{ {
{ 1.0f, 0.0f, 0.0f, 0.0f}, { 1.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 1.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f, 0.0f},
@ -589,14 +547,9 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect)
m[1][1] = cotangent; m[1][1] = cotangent;
m[2][2] = -(zFar + zNear) / deltaZ; m[2][2] = -(zFar + zNear) / deltaZ;
m[3][2] = -2.0f * zNear * zFar / deltaZ; m[3][2] = -2.0f * zNear * zFar / deltaZ;
#ifdef MINI_GL_COMPATIBILITY
pglMultMatrixf(&m[0][0]);
#else
pglMultMatrixd(&m[0][0]); pglMultMatrixd(&m[0][0]);
#endif
} }
#ifndef MINI_GL_COMPATIBILITY
static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ, static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
GLdouble* winX, GLdouble* winY, GLdouble* winZ) GLdouble* winX, GLdouble* winY, GLdouble* winZ)
{ {
@ -636,7 +589,6 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
*winY=in[1]; *winY=in[1];
*winZ=in[2]; *winZ=in[2];
} }
#endif
// -----------------+ // -----------------+
// SetModelView : // SetModelView :
@ -663,10 +615,8 @@ void SetModelView(GLint w, GLint h)
//pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT) //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT)
// added for new coronas' code (without depth buffer) // added for new coronas' code (without depth buffer)
#ifndef MINI_GL_COMPATIBILITY
pglGetIntegerv(GL_VIEWPORT, viewport); pglGetIntegerv(GL_VIEWPORT, viewport);
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
#endif
} }
@ -743,9 +693,7 @@ void SetStates(void)
// bp : when no t&l :) // bp : when no t&l :)
pglLoadIdentity(); pglLoadIdentity();
pglScalef(1.0f, 1.0f, -1.0f); pglScalef(1.0f, 1.0f, -1.0f);
#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
#endif
} }
@ -909,10 +857,8 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
pglMatrixMode(GL_MODELVIEW); pglMatrixMode(GL_MODELVIEW);
// added for new coronas' code (without depth buffer) // added for new coronas' code (without depth buffer)
#ifndef MINI_GL_COMPATIBILITY
pglGetIntegerv(GL_VIEWPORT, viewport); pglGetIntegerv(GL_VIEWPORT, viewport);
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
#endif
} }
@ -959,12 +905,6 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
GLRGBAFloat c; GLRGBAFloat c;
// DBG_Printf ("DrawLine() (%f %f %f) %d\n", v1->x, -v1->y, -v1->z, v1->argb); // DBG_Printf ("DrawLine() (%f %f %f) %d\n", v1->x, -v1->y, -v1->z, v1->argb);
#ifdef MINI_GL_COMPATIBILITY
GLfloat px1, px2, px3, px4;
GLfloat py1, py2, py3, py4;
GLfloat dx, dy;
GLfloat angle;
#endif
// BP: we should reflect the new state in our variable // BP: we should reflect the new state in our variable
//SetBlend(PF_Modulated|PF_NoTexture); //SetBlend(PF_Modulated|PF_NoTexture);
@ -976,33 +916,11 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
c.blue = byte2float[Color.s.blue]; c.blue = byte2float[Color.s.blue];
c.alpha = byte2float[Color.s.alpha]; c.alpha = byte2float[Color.s.alpha];
#ifndef MINI_GL_COMPATIBILITY
pglColor4fv(&c.red); // is in RGBA float format pglColor4fv(&c.red); // is in RGBA float format
pglBegin(GL_LINES); pglBegin(GL_LINES);
pglVertex3f(v1->x, -v1->y, 1.0f); pglVertex3f(v1->x, -v1->y, 1.0f);
pglVertex3f(v2->x, -v2->y, 1.0f); pglVertex3f(v2->x, -v2->y, 1.0f);
pglEnd(); pglEnd();
#else
if (v2->x != v1->x)
angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x));
else
angle = N_PI_DEMI;
dx = (float)sin(angle) / (float)screen_width;
dy = (float)cos(angle) / (float)screen_height;
px1 = v1->x - dx; py1 = v1->y + dy;
px2 = v2->x - dx; py2 = v2->y + dy;
px3 = v2->x + dx; py3 = v2->y - dy;
px4 = v1->x + dx; py4 = v1->y - dy;
pglColor4f(c.red, c.green, c.blue, c.alpha);
pglBegin(GL_TRIANGLE_FAN);
pglVertex3f(px1, -py1, 1);
pglVertex3f(px2, -py2, 1);
pglVertex3f(px3, -py3, 1);
pglVertex3f(px4, -py4, 1);
pglEnd();
#endif
pglEnable(GL_TEXTURE_2D); pglEnable(GL_TEXTURE_2D);
} }
@ -1188,7 +1106,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
!(pTexInfo->flags & TF_CHROMAKEYED)) !(pTexInfo->flags & TF_CHROMAKEYED))
{ {
// do nothing here. // do nothing here.
// Not a problem with MiniGL since we don't use paletted texture
} }
else else
#endif #endif
@ -1281,15 +1198,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
#ifdef MINI_GL_COMPATIBILITY
//if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88)
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
//else
if (MipMap)
pgluBuild2DMipmaps(GL_TEXTURE_2D, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
else
pglTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
#else
#ifdef USE_PALETTED_TEXTURE #ifdef USE_PALETTED_TEXTURE
//Hurdler: not really supported and not tested recently //Hurdler: not really supported and not tested recently
if (glColorTableEXT && if (glColorTableEXT &&
@ -1360,7 +1268,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else else
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
} }
#endif
if (pTexInfo->flags & TF_WRAPX) if (pTexInfo->flags & TF_WRAPX)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@ -1384,19 +1291,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else // initialisation de la liste else // initialisation de la liste
gr_cachetail = gr_cachehead = pTexInfo; gr_cachetail = gr_cachehead = pTexInfo;
} }
#ifdef MINI_GL_COMPATIBILITY
switch (pTexInfo->flags)
{
case 0 :
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
break;
default:
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
break;
}
#endif
} }
@ -1410,18 +1304,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
FBITFIELD PolyFlags) FBITFIELD PolyFlags)
{ {
FUINT i; FUINT i;
#ifndef MINI_GL_COMPATIBILITY
FUINT j; FUINT j;
#endif
GLRGBAFloat c = {0,0,0,0}; GLRGBAFloat c = {0,0,0,0};
#ifdef MINI_GL_COMPATIBILITY
if (PolyFlags & PF_Corona)
PolyFlags &= ~PF_NoDepthTest;
#else
if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD)) if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD))
PolyFlags &= ~(PF_NoDepthTest|PF_Corona); PolyFlags &= ~(PF_NoDepthTest|PF_Corona);
#endif
SetBlend(PolyFlags); //TODO: inline (#pragma..) SetBlend(PolyFlags); //TODO: inline (#pragma..)
@ -1443,16 +1330,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
c.alpha = byte2float[pSurf->FlatColor.s.alpha]; c.alpha = byte2float[pSurf->FlatColor.s.alpha];
} }
#ifdef MINI_GL_COMPATIBILITY
pglColor4f(c.red, c.green, c.blue, c.alpha);
#else
pglColor4fv(&c.red); // is in RGBA float format pglColor4fv(&c.red); // is in RGBA float format
#endif
} }
// this test is added for new coronas' code (without depth buffer) // this test is added for new coronas' code (without depth buffer)
// I think I should do a separate function for drawing coronas, so it will be a little faster // I think I should do a separate function for drawing coronas, so it will be a little faster
#ifndef MINI_GL_COMPATIBILITY
if (PolyFlags & PF_Corona) // check to see if we need to draw the corona if (PolyFlags & PF_Corona) // check to see if we need to draw the corona
{ {
//rem: all 8 (or 8.0f) values are hard coded: it can be changed to a higher value //rem: all 8 (or 8.0f) values are hard coded: it can be changed to a higher value
@ -1499,7 +1381,6 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
c.alpha *= scalef; // change the alpha value (it seems better than changing the size of the corona) c.alpha *= scalef; // change the alpha value (it seems better than changing the size of the corona)
pglColor4fv(&c.red); pglColor4fv(&c.red);
} }
#endif
if (PolyFlags & PF_MD2) if (PolyFlags & PF_MD2)
return; return;
@ -1602,7 +1483,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
case HWD_SET_TEXTUREFILTERMODE: case HWD_SET_TEXTUREFILTERMODE:
switch (Value) switch (Value)
{ {
#ifndef MINI_GL_COMPATIBILITY
case HWD_SET_TEXTUREFILTER_TRILINEAR: case HWD_SET_TEXTUREFILTER_TRILINEAR:
min_filter = GL_LINEAR_MIPMAP_LINEAR; min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_LINEAR; mag_filter = GL_LINEAR;
@ -1631,7 +1511,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
mag_filter = GL_NEAREST; mag_filter = GL_NEAREST;
MipMap = GL_TRUE; MipMap = GL_TRUE;
break; break;
#endif
default: default:
mag_filter = GL_LINEAR; mag_filter = GL_LINEAR;
min_filter = GL_NEAREST; min_filter = GL_NEAREST;
@ -1861,9 +1740,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5) GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
else else
GLPerspective(stransform->fovxangle, ASPECT_RATIO); GLPerspective(stransform->fovxangle, ASPECT_RATIO);
#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer) pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
#endif
pglMatrixMode(GL_MODELVIEW); pglMatrixMode(GL_MODELVIEW);
} }
else else
@ -1877,15 +1754,11 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
else else
//Hurdler: is "fov" correct? //Hurdler: is "fov" correct?
GLPerspective(fov, ASPECT_RATIO); GLPerspective(fov, ASPECT_RATIO);
#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer) pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
#endif
pglMatrixMode(GL_MODELVIEW); pglMatrixMode(GL_MODELVIEW);
} }
#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
#endif
} }
EXPORT INT32 HWRAPI(GetTextureUsed) (void) EXPORT INT32 HWRAPI(GetTextureUsed) (void)
@ -2060,9 +1933,7 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
INT32 texsize = 2048; INT32 texsize = 2048;
float xfix, yfix; float xfix, yfix;
#ifndef MINI_GL_COMPATIBILITY
INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set
#endif
// Use a power of two texture, dammit // Use a power of two texture, dammit
if(screen_width <= 1024) if(screen_width <= 1024)
@ -2102,7 +1973,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip); SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip);
#ifndef MINI_GL_COMPATIBILITY
if (gl13) if (gl13)
{ {
// Draw the end screen that fades in // Draw the end screen that fades in
@ -2145,7 +2015,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
} }
else else
{ {
#endif
// Draw the end screen that fades in // Draw the end screen that fades in
pglBindTexture(GL_TEXTURE_2D, endScreenWipe); pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
pglBegin(GL_QUADS); pglBegin(GL_QUADS);
@ -2167,9 +2036,7 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
pglTexCoord2f(xfix, 0.0f); pglTexCoord2f(xfix, 0.0f);
pglVertex3f(1.0f, -1.0f, 1.0f); pglVertex3f(1.0f, -1.0f, 1.0f);
pglEnd(); pglEnd();
#ifndef MINI_GL_COMPATIBILITY
} }
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
} }

View file

@ -37,13 +37,11 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#ifndef MINI_GL_COMPATIBILITY
#ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static #ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#include <GL/glext.h> #include <GL/glext.h>
#endif #endif
#endif #endif
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows #define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h" #include "../../doomdef.h"