summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFXVideo/macsrc/GL3Code.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-11-10 23:53:25 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-11-10 23:53:25 +0000
commitf7961efaeebdf1e717803824936db51e9af19d52 (patch)
tree0945a3bcccc0036e1a48d2d45e743fe895cd4668 /macosx/plugins/DFXVideo/macsrc/GL3Code.m
parent85f51f61c8dcaf9489ee3191be78a61d7e03e638 (diff)
downloadpcsxr-f7961efaeebdf1e717803824936db51e9af19d52.tar.gz
OS X: Consolidate the SoftGL plug-in's OpenGL functions into one file again.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@92231 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFXVideo/macsrc/GL3Code.m')
-rw-r--r--macosx/plugins/DFXVideo/macsrc/GL3Code.m188
1 files changed, 0 insertions, 188 deletions
diff --git a/macosx/plugins/DFXVideo/macsrc/GL3Code.m b/macosx/plugins/DFXVideo/macsrc/GL3Code.m
deleted file mode 100644
index 039de9a0..00000000
--- a/macosx/plugins/DFXVideo/macsrc/GL3Code.m
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// GL3Code.m
-// Pcsxr
-//
-// Created by C.W. Betts on 11/26/13.
-//
-//
-
-#import <Cocoa/Cocoa.h>
-#include <OpenGL/gl3.h>
-#include <OpenGL/gl3ext.h>
-#import <GLKit/GLKit.h>
-#import "PluginGLView.h"
-#import "SGPUPreferences.h"
-#include "externals.h"
-#undef BOOL
-#include "gpu.h"
-#include "swap.h"
-
-static int mylog2(int val)
-{
- int i;
- for (i=1; i<31; i++)
- if (val <= (1 << i))
- return (1 << i);
-
- return -1;
-}
-
-@implementation PluginGLView (GL3)
-
-- (BOOL)setupOpenGL3
-{
- static const NSOpenGLPixelFormatAttribute attrs[] =
- {
- NSOpenGLPFAAccelerated,
- NSOpenGLPFANoRecovery,
- NSOpenGLPFADoubleBuffer,
- NSOpenGLPFAOpenGLProfile,
- NSOpenGLProfileVersion3_2Core,
- 0
- };
-
- // Get pixel format from OpenGL
- NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
- if (!pixFmt) {
- NSLog(@"OpenGL 3 context could not be created.");
- NSLog(@"Legacy context will be tried.");
- return NO;
- }
-
- [self setPixelFormat:pixFmt];
-
- return NO;
-}
-
-- (void)cleanupGL3
-{
-
-}
-
-- (void)reshapeGL3
-{
- NSOpenGLContext *oglContext = [self openGLContext];
- NSRect rect;
-
- [oglContext makeCurrentContext];
- [oglContext update];
-
- rect = [[oglContext view] bounds];
-
- glViewport(0, 0, (int) rect.size.width, (int) rect.size.height);
-
- //glMatrixMode(GL_PROJECTION);
- //glLoadIdentity();
-
- //glMatrixMode(GL_MODELVIEW);
- //glLoadIdentity();
-
- drawBG = YES;
-
- [NSOpenGLContext clearCurrentContext];
-}
-
-- (void)renderScreenGL3
-{
- NSRect rect = [[[self openGLContext] view] bounds];
-
- GLKMatrix4 matrix = GLKMatrix4MakeOrtho(0, rect.size.width, 0, rect.size.height, 0, 0);
-}
-
-- (void)loadTexturesGL3:(GLboolean)first
-{
-
-}
-
-- (void)swapBufferGL3
-{
-
-}
-
-- (GLuint)loadShader:(GLenum)type location:(NSURL*)filename
-{
- GLuint myShader = 0;
-
- GLsizei logsize = 0;
- GLint compile_status = GL_TRUE;
- char *log = NULL;
- char *src = NULL;
-
- /* creation d'un shader de sommet */
- myShader = glCreateShader(type);
- if(myShader == 0)
- {
- NSLog(@"impossible de creer le shader");
- return 0;
- }
-
- /* chargement du code source */
- src = [PluginGLView loadSource:filename];
- if(src == NULL)
- {
- /* theoriquement, la fonction LoadSource a deja affiche un message
- d'erreur, nous nous contenterons de supprimer notre shader
- et de retourner 0 */
-
- glDeleteShader(myShader);
- return 0;
- }
-
- /* assignation du code source */
- glShaderSource(myShader, 1, (const GLchar**)&src, NULL);
-
- /* compilation du shader */
- glCompileShader(myShader);
-
- /* liberation de la memoire du code source */
- free(src);
- src = NULL;
-
- /* verification du succes de la compilation */
- glGetShaderiv(myShader, GL_COMPILE_STATUS, &compile_status);
- if(compile_status != GL_TRUE)
- {
- /* erreur a la compilation recuperation du log d'erreur */
-
- /* on recupere la taille du message d'erreur */
- glGetShaderiv(myShader, GL_INFO_LOG_LENGTH, &logsize);
-
- /* on alloue un espace memoire dans lequel OpenGL ecrira le message */
- log = calloc(logsize + 1, 1);
- if(log == NULL)
- {
- NSLog(@"impossible d'allouer de la memoire!");
- return 0;
- }
-
- glGetShaderInfoLog(myShader, logsize, &logsize, log);
- NSLog(@"impossible de compiler le shader '%@' :\n%s",
- [filename path], log);
-
- /* ne pas oublier de liberer la memoire et notre shader */
- free(log);
- glDeleteShader(myShader);
-
- return 0;
- }
- return myShader;
-}
-
-@end
-
-void printProgramInfoLog(GLuint obj)
-{
- int infologLength = 0;
- int charsWritten = 0;
- char *infoLog;
-
- glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &infologLength);
-
- if (infologLength > 0)
- {
- infoLog = (char *)malloc(infologLength);
- glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog);
- NSLog(@"%s", infoLog);
- free(infoLog);
- }
-}