ColonelPanic

OpenGL Device

Mar 7th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifdef __APPLE__
  4. #include <OpenGL/OpenGL.h>
  5. #include "OpenGLView.h"
  6. #elif WIN32
  7. #include <Windows.h>
  8. #endif
  9.  
  10. #ifdef __cplusplus
  11.  
  12. #include "../System/System.h"
  13.  
  14. namespace Goldberg
  15. {
  16.    
  17. class Device
  18. {
  19. public:
  20.    Device();
  21.    ~Device();
  22.  
  23.    bool SwapBuffers() const;
  24.    
  25. #ifdef __APPLE__
  26.    bool Initialize(OpenGLView *view);
  27.    NSOpenGLContext * const Context() const;
  28.    NSOpenGLPixelFormat * const PixelFormat() const;
  29. #elif WIN32
  30.    bool Initialize(HWND window);
  31. #endif
  32.    
  33. private:
  34.    DISALLOW_COPY_AND_ASSIGN(Device);
  35.  
  36. #ifdef __APPLE__
  37.    NSOpenGLContext *context;
  38.    NSOpenGLPixelFormat *pixelFormat;
  39.    OpenGLView *view;
  40. #elif WIN32
  41.    HWND window;  
  42.    HDC deviceContext;  
  43.    HGLRC renderingContext;
  44. #endif
  45. };
  46.    
  47. } // Goldberg
  48.  
  49. extern "C"
  50. {
  51. #endif // __cplusplus
  52. typedef struct Device_s *DevicePtr;
  53.  
  54. void DeviceCreate(DevicePtr *pDevice, OpenGLView *view);
  55. void DeviceDestroy(DevicePtr *pDevice);
  56. BOOL DeviceSwapBuffers(DevicePtr device);
  57. #ifdef __APPLE__
  58. NSOpenGLContext * DeviceGetContext(DevicePtr device);
  59. NSOpenGLPixelFormat *DeviceGetPixelFormat(DevicePtr device);
  60. void DeviceLock(DevicePtr device);
  61. void DeviceUnlock(DevicePtr device);
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. }
  66. #endif // __cplusplus
Advertisement
Add Comment
Please, Sign In to add comment