00001
00002
00003 #ifndef NV_GLAPPCONTEXT_H
00004 #define NV_GLAPPCONTEXT_H
00005
00006 #include <NvFoundation.h>
00007 #include <NV/NvPlatformGL.h>
00008
00011
00013 struct NvEGLConfiguration {
00014
00023 NvEGLConfiguration(const NvGfxAPIVersion& _apiVer = NvGfxAPIVersionES2(),
00024 uint32_t r = 8, uint32_t g = 8,
00025 uint32_t b = 8, uint32_t a = 8,
00026 uint32_t d = 24, uint32_t s = 0) : apiVer(_apiVer),
00027 redBits(r), greenBits(g), blueBits(b), alphaBits(a),
00028 depthBits(d), stencilBits(s) {}
00029
00030 NvGfxAPIVersion apiVer;
00031 uint32_t redBits;
00032 uint32_t greenBits;
00033 uint32_t blueBits;
00034 uint32_t alphaBits;
00035 uint32_t depthBits;
00036 uint32_t stencilBits;
00037 };
00038
00040 struct NvGLPlatformCategory {
00041 enum Enum {
00042 PLAT_MOBILE,
00043 PLAT_DESKTOP
00044 };
00045 };
00046
00048 struct NvGLPlatformOS {
00049 enum Enum {
00050 OS_ANDROID,
00051 OS_WINDOWS,
00052 OS_LINUX,
00053 OS_MACOSX
00054 };
00055 };
00056
00058 struct NvGLPlatformInfo {
00062 NvGLPlatformInfo(NvGLPlatformCategory::Enum category, NvGLPlatformOS::Enum os) :
00063 mCategory(category)
00064 , mOS(os)
00065 { }
00066
00067 NvGLPlatformCategory::Enum mCategory;
00068 NvGLPlatformOS::Enum mOS;
00069 };
00070
00072 class NvGLAppContext {
00073 public:
00074 virtual ~NvGLAppContext() {}
00075
00078 virtual bool bindContext() = 0;
00079
00082 virtual bool unbindContext() = 0;
00083
00086 virtual bool swap() = 0;
00087
00091 virtual bool setSwapInterval(int32_t interval) = 0;
00092
00095 virtual int32_t width() = 0;
00096
00099 virtual int32_t height() = 0;
00100
00103 const NvEGLConfiguration& getConfiguration() const { return mConfig; }
00104
00105
00108 const NvGLPlatformInfo& getPlatformInfo() const { return mPlatformInfo; }
00109
00111 typedef void (*GLproc)(void);
00112
00118 virtual GLproc getGLProcAddress(const char* procname) = 0;
00119
00124 virtual bool isExtensionSupported(const char* ext) = 0;
00125
00132 virtual bool requestResetContext() { return false; }
00133
00138 virtual void* getCurrentPlatformContext() { return NULL; }
00139
00144 virtual void* getCurrentPlatformDisplay() { return NULL; }
00145
00146 protected:
00148 NvGLAppContext(NvGLPlatformInfo info) :
00149 mPlatformInfo(info) {}
00150 NvEGLConfiguration mConfig;
00151 NvGLPlatformInfo mPlatformInfo;
00152 };
00153
00154 #endif