1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 /* OpenGLFramebuffer: 14 * Encapsulates an OpenGL framebuffer object for multisampled rendering. 15 */ 16 17 #ifndef OPENGLFRAMEBUFFER_H 18 #define OPENGLFRAMEBUFFER_H 19 20 #include "common.h" 21 22 // common headers 23 #include "bzfgl.h" 24 25 class OpenGLFramebuffer 26 { 27 private: 28 bool contextActive; 29 int msaaLevel, width, height; 30 GLuint renderbuffer, depthRenderbuffer, framebuffer; 31 32 void initFramebuffer(); 33 void destroyFramebuffer(); 34 35 public: 36 OpenGLFramebuffer(); 37 ~OpenGLFramebuffer(); 38 39 void checkState(int, int, int); 40 getFramebuffer()41 GLint getFramebuffer() 42 { 43 return framebuffer; 44 } 45 46 static void freeContext(void*); 47 static void initContext(void*); 48 }; 49 50 #endif // OPENGLFRAMEBUFFER_H 51 52 53 /* 54 * Local Variables: *** 55 * mode: C++ *** 56 * tab-width: 8 *** 57 * c-basic-offset: 2 *** 58 * indent-tabs-mode: t *** 59 * End: *** 60 * ex: shiftwidth=2 tabstop=8 61 */ 62