summaryrefslogtreecommitdiff
path: root/plugins/peopsxgl/draw.c
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-02-18 08:58:58 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-02-18 08:58:58 +0000
commit34cfcc5169cafa8ae9e0d6469e20dc11c122c077 (patch)
tree47ddff4f53156e888c370b12c405a6849a9cb2a6 /plugins/peopsxgl/draw.c
parent394f7a2b4a604dc40cf29f23a7121deb19eed79c (diff)
downloadpcsxr-34cfcc5169cafa8ae9e0d6469e20dc11c122c077.tar.gz
-(SysBeep)Added Mac OS X port of P.E.Op.S OpenGL plugin. (Patch #8361)
-Fixed help message for Windows. (Issue #8028). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@63522 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/peopsxgl/draw.c')
-rw-r--r--plugins/peopsxgl/draw.c52
1 files changed, 46 insertions, 6 deletions
diff --git a/plugins/peopsxgl/draw.c b/plugins/peopsxgl/draw.c
index 32dcc83b..748824a1 100644
--- a/plugins/peopsxgl/draw.c
+++ b/plugins/peopsxgl/draw.c
@@ -27,6 +27,11 @@
#include "texture.h"
#include "menu.h"
+#if defined(_MACGL)
+// if you use it, you must include it
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#endif
////////////////////////////////////////////////////////////////////////////////////
// defines
@@ -125,9 +130,13 @@ BOOL bGLExt;
BOOL bGLFastMovie=FALSE;
BOOL bGLSoft;
BOOL bGLBlend;
+#if defined (_MACGL) // always supported on OSX > 10.4.3
+#define glBlendEquationEXTEx glBlendEquationEXT
+#define glColorTableEXTEx glColorTableEXT
+#else
PFNGLBLENDEQU glBlendEquationEXTEx=NULL;
PFNGLCOLORTABLEEXT glColorTableEXTEx=NULL;
-
+#endif
// gfx card buffer infos
int iDepthFunc=0;
@@ -215,7 +224,9 @@ void GetExtInfos(void)
iClampType=GL_TO_EDGE_CLAMP;
else iClampType=GL_CLAMP;
+#if !defined (_MACGL) // OSX > 10.4.3 defines this
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)NULL; // init ogl palette func pointer
+#endif
#ifndef __sun
if(iGPUHeight!=1024 && // no pal textures in ZN mode (height=1024)!
@@ -226,11 +237,14 @@ void GetExtInfos(void)
#ifdef _WINDOWS
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)wglGetProcAddress("glColorTableEXT");
+#elif defined (_MACGL)
+ // no prob, done already in OSX > 10.4.3
#else
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)glXGetProcAddress("glColorTableEXT");
#endif
if(glColorTableEXTEx==NULL) iUsePalTextures=0; // -> ha, cheater... no func, no support
+
}
else iUsePalTextures=0;
#else
@@ -261,13 +275,17 @@ void SetExtGLFuncs(void)
if(wglSwapIntervalEXT) wglSwapIntervalEXT(iForceVSync);
}
#endif
-
+#ifdef _MACGL
+ SetVSync(iForceVSync);
+#endif
if(iUseExts && !(dwActFixes&1024) && // extensions wanted? and not turned off by game fix?
strstr((char *)glGetString(GL_EXTENSIONS), // and blend_subtract available?
"GL_EXT_blend_subtract"))
{ // -> get ogl blend function pointer
#ifdef _WINDOWS
glBlendEquationEXTEx=(PFNGLBLENDEQU)wglGetProcAddress("glBlendEquationEXT");
+#elif defined(_MACGL)
+ // no prob, OSX > 10.4.3 has this
#else
glBlendEquationEXTEx=(PFNGLBLENDEQU)glXGetProcAddress("glBlendEquationEXT");
#endif
@@ -276,7 +294,9 @@ void SetExtGLFuncs(void)
{
if(glBlendEquationEXTEx) // -> change to additive blending (if subract was active)
glBlendEquationEXTEx(FUNC_ADD_EXT);
+#if !defined(_MACGL) // BTW, why set to null? strange...
glBlendEquationEXTEx=(PFNGLBLENDEQU)NULL; // -> no more blend function pointer
+#endif
}
//----------------------------------------------------//
@@ -501,8 +521,24 @@ void CreateScanLines(void)
{
uiScanLine=glGenLists(1);
glNewList(uiScanLine,GL_COMPILE);
-
- for(y=0;y<iResY;y+=2)
+ #ifdef _MACGL
+ // not mac specific, just commenting out to be friendly
+ // use it if you like
+ // this draws anti-aliased lines with user-chosen color
+ glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT);
+ glEnable(GL_BLEND | GL_LINE_SMOOTH);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(iScanlineColor[0],iScanlineColor[1],iScanlineColor[2],iScanlineColor[3]);
+ glBegin(GL_LINES);
+ for(y=0;y<iResY;y+=2)
+ {
+ glVertex2f(0,y);
+ glVertex2f(iResX,y);
+ }
+ glEnd();
+ glPopAttrib();
+ #else
+ for(y=0;y<iResY;y+=2)
{
glBegin(GL_QUADS);
glVertex2f(0,y);
@@ -511,7 +547,9 @@ void CreateScanLines(void)
glVertex2f(0,y+1);
glEnd();
}
- glEndList();
+
+ #endif
+ glEndList();
}
}
}
@@ -536,7 +574,9 @@ int GLinitialize()
// CheckWGLExtensions(dcGlobal);
if(bWindowMode) ReleaseDC(hWWindow,dcGlobal); // win mode: release dc again
#endif
-
+#if defined (_MACGL)
+ BringContextForward();
+#endif
glViewport(rRatioRect.left, // init viewport by ratio rect
iResY-(rRatioRect.top+rRatioRect.bottom),
rRatioRect.right,