Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2855)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2855)
@@ -0,0 +1,111 @@
+#include <iostream>
+#include "FrameBufferObject.h"
+#include "glInterface.h"
+
+using namespace std;
+
+
+namespace CHCDemoEngine
+{
+
+
+void PrintFBOStatus(GLenum status)
+{
+	switch(status)
+	{
+	case GL_FRAMEBUFFER_COMPLETE_EXT:
+		cout << "frame buffer object created successfully" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
+		cerr << "incomplete attachment" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
+		cerr << "missing attachment" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
+		cerr << "incomplete dimensions" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
+		cerr << "incomplete formats" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
+		cerr << "incomplete draw buffer" << endl;
+		break;
+	case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
+		cerr << "incomplete read buffer" << endl;
+		break;
+	case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
+		cerr << "framebuffer unsupported" << endl;
+		break;
+	default:
+		cerr << "unknown status code " << status << endl;
+	}
+}
+
+
+ColorBufferObject::ColorBufferObject(int w, int h, 
+									 COLOR_FORMAT c, 
+									 int wrapType, 
+									 int filterType, 
+									 bool useMipMap, 
+									 bool useMultiSampling)
+{
+/*	
+	glGenRenderbuffersEXT(1, &normalsBuffer);
+	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, normalsBuffer);
+	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, texWidth, texHeight);
+	
+	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_RENDERBUFFER_EXT, normalsBuffer);
+
+	glGenTextures(1, &normalsTex);
+	glBindTexture(GL_TEXTURE_2D, normalsTex);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texWidth, texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, normalsTex, 0);
+
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+	PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
+*/
+}
+
+
+FrameBufferObject::FrameBufferObject(int w, int h, bool useDepth, DEPTH_FORMAT d)
+: mWidth(w), mHeight(h)
+{
+	glGenFramebuffersEXT(1, &mId);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);
+
+	
+	///////////
+	//-- create depth buffer
+
+	if (useDepth)
+	{
+		glGenRenderbuffersEXT(1, &mDepthId);	
+		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepthId);
+
+		GLuint depthFormat;
+
+		switch (d)
+		{
+		case DEPTH_16:
+			depthFormat = GL_DEPTH_COMPONENT16; break;
+		case DEPTH_24:
+			depthFormat = GL_DEPTH_COMPONENT24; break;
+		case DEPTH_32: 
+			depthFormat = GL_DEPTH_COMPONENT32; break;
+		}
+
+		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormat, mWidth, mHeight);
+		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepthId);
+
+		PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
+	}
+}
+
+
+} // namespace
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2855)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2855)
@@ -0,0 +1,60 @@
+#ifndef _FrameBufferObject_H__
+#define _FrameBufferObject_H__
+
+#include <vector>
+#include "common.h"
+
+
+namespace CHCDemoEngine 
+{ 
+
+
+/** This class implements a wrapper for a color buffer object
+*/
+class ColorBufferObject
+{
+public:
+
+	enum COLOR_FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32 };
+
+	ColorBufferObject(int w, int h, 
+		              COLOR_FORMAT c, 
+					  int wrapType, 
+					  int filterType, 
+					  bool useMipMap, 
+					  bool useMultiSampling);
+};
+
+
+/** This class implements a wrapper for a frame buffer object
+*/
+class FrameBufferObject
+{
+public:
+
+	enum DEPTH_FORMAT { DEPTH_16, DEPTH_24, DEPTH_32 };
+	/** constructor requesting an opengl occlusion query.
+	*/
+	FrameBufferObject(int w, int h, bool useDepth, DEPTH_FORMAT d);
+	/** Creates and adds a color buffer to the current frame buffer object.
+		Returns a pointer to the buffer object
+	*/
+	ColorBufferObject *AddColorBuffer(ColorBufferObject::COLOR_FORMAT col, 
+		                              int wrapType, 
+									  int filterType, 
+									  bool useMipMap, 
+									  bool useMultiSampling);
+
+protected:
+
+	std::vector<ColorBufferObject *> mColorBuffers;
+
+	unsigned int mId;
+	unsigned int mDepthId;
+
+	int mHeight;
+	int mWidth;
+};
+
+} // namespace 
+#endif // _FrameBufferObject_H__
