Batch Context Creator
Module for generating OpenGL batch contexts
gl-batch-context/Context.hpp
00001 
00004 
00005 #ifndef IAUNS_GL_BATCH_CONTEXT_BATCH_HPP
00006 #define IAUNS_GL_BATCH_CONTEXT_BATCH_HPP
00007 
00008 #include <stdint.h>
00009 
00010 namespace CPM_GL_BATCH_CONTEXT_NS {
00011 
00013 class Context
00014 {
00015 public:
00016   Context();
00017   virtual ~Context();
00018 
00019   virtual bool isValid() const=0;
00020 
00022   static Context* createBatchContext(
00023       uint32_t width, uint32_t height, uint8_t color_bits, uint8_t depth_bits,
00024       uint8_t stencil_bits, bool double_buffer, bool visible);
00025 
00026   //============================================================================
00027   // Mandatory OpenGL-context related functions
00028   //============================================================================
00029 
00031   virtual void makeCurrent()    = 0;
00032 
00034   virtual void swapBuffers()    = 0;
00035 };
00036 
00037 class NoAvailableContext : public std::exception
00038 {
00039   public:
00040     virtual ~NoAvailableContext() throw() {}
00041     virtual const char* what() const throw()
00042     {
00043       return "No context was available to utilize.";
00044     }
00045 };
00046 
00047 } // namespace CPM_GL_BATCH_CONTEXT_NS
00048 
00049 #endif