00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGFBOVIEWPORT_H_
00040 #define _OSGFBOVIEWPORT_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGConfig.h>
00046 #include <OSGGL.h>
00047 #include <OSGGLEXT.h>
00048 #include <OSGWindow.h>
00049 #include <OSGAction.h>
00050 #include <OSGRenderAction.h>
00051
00052 #include "OSGFBOViewportBase.h"
00053
00054 OSG_BEGIN_NAMESPACE
00055
00060 class OSG_SYSTEMLIB_DLLMAPPING FBOViewport : public FBOViewportBase
00061 {
00062 private:
00063
00064 typedef FBOViewportBase Inherited;
00065
00066
00067 public:
00068
00069 enum RenderBufferAttachmentType
00070 {
00071 NONE = 0,
00072 FBO_DEPTH_16 = 1,
00073 FBO_DEPTH_24 = 2,
00074 FBO_DEPTH_32 = 4,
00075 FBO_STENCIL_1 = 8,
00076 FBO_STENCIL_4 = 16,
00077 FBO_STENCIL_8 = 32,
00078 FBO_STENCIL_16 = 64
00079 };
00080
00081
00085 static const char *getClassname(void) { return "FBOViewport"; }
00086
00088
00092 virtual void render(RenderActionBase *action);
00093
00095
00099 bool initialize(Window *win, Int32 format = NONE);
00100 void setTarget(Window *win, UInt32 id, GLenum attachment, GLenum target);
00101 void bind(Window *win);
00102 void stop(Window *win);
00103 bool checkFrameBufferStatus(Window *win);
00104 Int32 getMaxBuffers(void);
00105
00107
00111 virtual void changed(BitVector whichField,
00112 UInt32 origin );
00113
00115
00119 virtual void dump( UInt32 uiIndent = 0,
00120 const BitVector bvFlags = 0) const;
00121
00123
00127 enum
00128 {
00129 FBO_RP_NONE = 0,
00130 FBO_RP_EFFECTS = 1
00131 };
00132
00133 typedef void (*renderparamscbfp) (UInt32 params);
00134 static void setRenderParamsCB(renderparamscbfp fp);
00135
00137
00138 protected:
00139
00140
00141
00142 bool extensionCheck(void);
00143
00144
00148 FBOViewport(void);
00149 FBOViewport(const FBOViewport &source);
00150
00152
00156 virtual ~FBOViewport(void);
00157
00158 void onCreate(const FBOViewport *source = NULL);
00159 void onDestroy(void);
00160
00163
00164 private:
00165
00166 friend class FieldContainer;
00167 friend class FBOViewportBase;
00168
00169
00173 static UInt32 _framebuffer_object_extension;
00174 static UInt32 _draw_buffers_extension;
00175
00176 static UInt32 _funcDrawBuffers;
00177 static UInt32 _funcBindFramebuffer;
00178 static UInt32 _funcBindRenderbuffer;
00179 static UInt32 _funcCheckFramebufferStatus;
00180 static UInt32 _funcDeleteFramebuffers;
00181 static UInt32 _funcDeleteRenderbuffers;
00182 static UInt32 _funcFramebufferRenderbuffer;
00183 static UInt32 _funcFramebufferTexture1D;
00184 static UInt32 _funcFramebufferTexture2D;
00185 static UInt32 _funcFramebufferTexture3D;
00186 static UInt32 _funcGenFramebuffers;
00187 static UInt32 _funcGenRenderbuffers;
00188 static UInt32 _funcGenerateMipmap;
00189 static UInt32 _funcGetFramebufferAttachmentParameteriv;
00190 static UInt32 _funcGetRenderbufferParameteriv;
00191 static UInt32 _funcIsFramebuffer;
00192 static UInt32 _funcIsRenderbuffer;
00193 static UInt32 _funcRenderbufferStorage;
00194
00195 static renderparamscbfp _renderParamsFP;
00198 static void initMethod(void);
00199
00200
00201
00202 void operator =(const FBOViewport &source);
00203 };
00204
00205 typedef FBOViewport *FBOViewportP;
00206
00207 OSG_END_NAMESPACE
00208
00209 #include "OSGFBOViewportBase.inl"
00210 #include "OSGFBOViewport.inl"
00211
00212 #define OSGFBOVIEWPORT_HEADER_CVSID "@(#)$Id: OSGFBOViewport.h,v 1.1 2007/03/12 15:03:01 a-m-z Exp $"
00213
00214 #endif