2010-12-23 15:00:45 +00:00
|
|
|
#ifndef SkEGLContext_DEFINED
|
|
|
|
#define SkEGLContext_DEFINED
|
2010-12-21 16:26:39 +00:00
|
|
|
|
2011-05-19 17:47:02 +00:00
|
|
|
#if defined(SK_MESA)
|
|
|
|
#include "GL/osmesa.h"
|
|
|
|
#elif defined(SK_BUILD_FOR_MAC)
|
2011-05-17 14:24:46 +00:00
|
|
|
#include <AGL/agl.h>
|
|
|
|
#elif defined(SK_BUILD_FOR_UNIX)
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <GL/glx.h>
|
2011-05-31 21:21:54 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_WIN32)
|
2011-06-02 15:38:06 +00:00
|
|
|
#include <Windows.h>
|
|
|
|
#include <GL/GL.h>
|
2011-05-17 14:24:46 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
#endif
|
2010-12-21 16:26:39 +00:00
|
|
|
|
2010-12-23 15:00:45 +00:00
|
|
|
/**
|
|
|
|
* Create an offscreen opengl context
|
|
|
|
*/
|
2010-12-21 16:26:39 +00:00
|
|
|
class SkEGLContext {
|
|
|
|
public:
|
2011-05-17 14:24:46 +00:00
|
|
|
SkEGLContext();
|
|
|
|
~SkEGLContext();
|
2010-12-21 16:26:39 +00:00
|
|
|
|
2011-05-19 17:47:02 +00:00
|
|
|
bool init(const int width, const int height);
|
2010-12-21 16:26:39 +00:00
|
|
|
|
|
|
|
private:
|
2011-05-19 17:47:02 +00:00
|
|
|
#if defined(SK_MESA)
|
|
|
|
OSMesaContext context;
|
|
|
|
GLfloat *image;
|
|
|
|
#elif defined(SK_BUILD_FOR_MAC)
|
2011-05-17 14:24:46 +00:00
|
|
|
AGLContext context;
|
|
|
|
#elif defined(SK_BUILD_FOR_UNIX)
|
|
|
|
GLXContext context;
|
|
|
|
Display *display;
|
|
|
|
Pixmap pixmap;
|
|
|
|
GLXPixmap glxPixmap;
|
2011-06-02 15:38:06 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_WIN32)
|
|
|
|
HWND fWindow;
|
|
|
|
HDC fDeviceContext;
|
|
|
|
HGLRC fGlRenderContext;
|
2011-05-17 14:24:46 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
#endif
|
2010-12-21 16:26:39 +00:00
|
|
|
};
|
|
|
|
|
2010-12-23 15:00:45 +00:00
|
|
|
#endif
|