00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GPU_FRAMEBUFFER
00009 #define GPU_FRAMEBUFFER
00010
00011 #ifdef QMC_GPU
00012
00013 #include <iostream>
00014 #include <stdlib.h>
00015 #include <assert.h>
00016 #include <math.h>
00017 #include <vector>
00018 #include <string>
00019
00020 #include "GPUGlobals.h"
00021
00046 class GPUQMCFramebuffer
00047 {
00048 public:
00049 GPUQMCFramebuffer();
00050
00059 GPUQMCFramebuffer(int width, int height, int numFB, int numRT);
00060
00066 void operator=(GPUQMCFramebuffer & rhs);
00067
00071 ~GPUQMCFramebuffer();
00072
00082 void initialize(int width, int height, int numFB, int numRT);
00083
00088 int getWidth();
00089
00094 int getHeight();
00095
00120 void drawTo(int whichFB);
00121
00129 void readFrom(int whichFB, int whichRT);
00130
00139 void cleanBuffer(int whichFB);
00140
00145 void cleanAllBuffers();
00146
00151 void swapBuffers();
00152
00156 void setupSwapBuffers(int first, int second);
00157
00166 void checkFramebufferStatus();
00167
00172 GLuint addTexture();
00173
00178 void addTexture(GLuint newTexID);
00179
00184 void removeTexture(int whichRT);
00185
00191 GLuint getTextureID(int whichFB, int whichRT);
00192
00198 int getNumRT();
00199
00203 int getNumFB();
00204
00213 bool testExistance(int whichFB, int whichRT);
00214
00215 private:
00216
00220 vector< GLuint > theFrameBuffers;
00221
00226 vector< vector< GLuint > > attachedTextures;
00227
00233 vector< GLenum* > bufferAttachments;
00234
00238 int w, h;
00239
00243 const static int maxBuffers = 16;
00244 };
00245 #endif
00246 #endif
00247
00248
00249