2015-06-21 15:33:46 +00:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2019-01-05 06:01:14 +00:00
|
|
|
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
#include "../../SDL_internal.h"
|
|
|
|
|
2017-08-28 07:22:23 +00:00
|
|
|
#ifndef SDL_cocoaopengl_h_
|
|
|
|
#define SDL_cocoaopengl_h_
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
#if SDL_VIDEO_OPENGL_CGL
|
|
|
|
|
|
|
|
#include "SDL_atomic.h"
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
2019-06-15 01:18:53 +00:00
|
|
|
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
|
|
|
|
#ifdef __clang__
|
|
|
|
#pragma clang diagnostic push
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
struct SDL_GLDriverData
|
|
|
|
{
|
|
|
|
int initialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
@interface SDLOpenGLContext : NSOpenGLContext {
|
|
|
|
SDL_atomic_t dirty;
|
|
|
|
SDL_Window *window;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithFormat:(NSOpenGLPixelFormat *)format
|
|
|
|
shareContext:(NSOpenGLContext *)share;
|
|
|
|
- (void)scheduleUpdate;
|
|
|
|
- (void)updateIfNeeded;
|
|
|
|
- (void)setWindow:(SDL_Window *)window;
|
2019-06-11 20:19:01 +00:00
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
/* OpenGL functions */
|
|
|
|
extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
|
|
|
|
extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc);
|
|
|
|
extern void Cocoa_GL_UnloadLibrary(_THIS);
|
|
|
|
extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window);
|
|
|
|
extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window,
|
|
|
|
SDL_GLContext context);
|
|
|
|
extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window,
|
|
|
|
int * w, int * h);
|
|
|
|
extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
|
|
|
|
extern int Cocoa_GL_GetSwapInterval(_THIS);
|
2016-12-09 09:47:43 +00:00
|
|
|
extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
|
|
|
|
|
2019-06-15 01:18:53 +00:00
|
|
|
#ifdef __clang__
|
|
|
|
#pragma clang diagnostic pop
|
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
#endif /* SDL_VIDEO_OPENGL_CGL */
|
|
|
|
|
2017-08-28 07:22:23 +00:00
|
|
|
#endif /* SDL_cocoaopengl_h_ */
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|