DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/hardware/voodoo_vogl.h
00001  /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 
00020 #ifndef DOSBOX_VOODOO_VOGL_H
00021 #define DOSBOX_VOODOO_VOGL_H
00022 
00023 #include "SDL.h"
00024 #include "SDL_opengl.h"
00025 
00026 
00027 /* opengl extensions */
00028 #ifdef WIN32
00029 extern PFNGLACTIVETEXTUREARBPROC __glActiveTextureARB;
00030 extern PFNGLMULTITEXCOORD4FARBPROC __glMultiTexCoord4fARB;
00031 extern PFNGLMULTITEXCOORD4FVARBPROC __glMultiTexCoord4fvARB;
00032 # define glMultiTexCoord4fv __glMultiTexCoord4fvARB
00033 # define glActiveTexture __glActiveTextureARB
00034 #endif
00035 
00036 extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
00037 extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
00038 extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
00039 extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
00040 extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
00041 extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
00042 extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
00043 extern PFNGLUNIFORM1IARBPROC glUniform1iARB;
00044 extern PFNGLUNIFORM1FARBPROC glUniform1fARB;
00045 extern PFNGLUNIFORM2FARBPROC glUniform2fARB;
00046 extern PFNGLUNIFORM3FARBPROC glUniform3fARB;
00047 extern PFNGLUNIFORM4FARBPROC glUniform4fARB;
00048 extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
00049 extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
00050 extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
00051 extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
00052 extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
00053 extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateExt;
00054 extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapExt;
00055 extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
00056 extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB;
00057 
00058 
00059 #define VOGL_ATLEAST_V20                        0x00000001
00060 #define VOGL_ATLEAST_V21                        0x00000002
00061 #define VOGL_ATLEAST_V30                        0x00000004
00062 #define VOGL_HAS_SHADERS                        0x00000010
00063 #define VOGL_HAS_STENCIL_BUFFER         0x00000100
00064 #define VOGL_HAS_ALPHA_PLANE            0x00000200
00065 
00066 
00067 static const GLuint ogl_sfactor[16] = {
00068         GL_ZERO,
00069         GL_SRC_ALPHA,
00070         GL_DST_COLOR,
00071         GL_DST_ALPHA,
00072         GL_ONE,
00073         GL_ONE_MINUS_SRC_ALPHA,
00074         GL_ONE_MINUS_DST_COLOR,
00075         GL_ONE_MINUS_DST_ALPHA,
00076         GL_ZERO,
00077         GL_ZERO,
00078         GL_ZERO,
00079         GL_ZERO,
00080         GL_ZERO,
00081         GL_ZERO,
00082         GL_ZERO,
00083         GL_SRC_ALPHA_SATURATE
00084 };
00085 
00086 static const GLuint ogl_dfactor[16] = {
00087         GL_ZERO,
00088         GL_SRC_ALPHA,
00089         GL_SRC_COLOR,
00090         GL_DST_ALPHA,
00091         GL_ONE,
00092         GL_ONE_MINUS_SRC_ALPHA,
00093         GL_ONE_MINUS_SRC_COLOR,
00094         GL_ONE_MINUS_DST_ALPHA,
00095         GL_ZERO,
00096         GL_ZERO,
00097         GL_ZERO,
00098         GL_ZERO,
00099         GL_ZERO,
00100         GL_ZERO,
00101         GL_ZERO,
00102         GL_SRC_COLOR /* A_COLORBEFOREFOG */
00103 };
00104 
00105 
00106 void VOGL_Reset(void);
00107 
00108 bool VOGL_Initialize(void);
00109 
00110 bool VOGL_CheckFeature(Bit32u feat);
00111 void VOGL_FlagFeature(Bit32u feat);
00112 
00113 void VOGL_BeginMode(INT32 new_mode);
00114 void VOGL_ClearBeginMode(void);
00115 
00116 void VOGL_SetDepthMode(Bit32s mode, Bit32s func);
00117 void VOGL_SetAlphaMode(Bit32s enabled_mode,GLuint src_rgb_fac,GLuint dst_rgb_fac,
00118                                                                                         GLuint src_alpha_fac,GLuint dst_alpha_fac);
00119 
00120 void VOGL_SetDepthMaskMode(bool masked);
00121 void VOGL_SetColorMaskMode(bool cmasked, bool amasked);
00122 
00123 void VOGL_SetDrawMode(bool front_draw);
00124 void VOGL_SetReadMode(bool front_read);
00125 
00126 #endif