Commit 0a3c77c3 authored by Lars Krecklau's avatar Lars Krecklau

- VertexBuffer and FrameBuffer renamed to VertexBufferObject and...

- VertexBuffer and FrameBuffer renamed to VertexBufferObject and FrameBufferObject respectively. This convention is more consistent regarding the State, which now gets a FrameBufferObject (FBO), VertexBufferObject (VBO) and ShaderProgramObject (SPO)
- Added controllers and objects to the Controller.hh and Objects.hh respectively
- Added corresponding managers
parent fae8d4a9
......@@ -18,15 +18,17 @@
#include <ACGL/Resource/NameManager.hh>
#include <ACGL/Resource/FileManager.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/ElementArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/FrameBufferObjectControl.hh>
#include <ACGL/OpenGL/Controller/RenderBufferControl.hh>
#include <ACGL/OpenGL/Controller/ShaderControlFile.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramControlAutoFiles.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramObjectControl.hh>
#include <ACGL/OpenGL/Controller/StateControl.hh>
#include <ACGL/OpenGL/Controller/TextureControl.hh>
#include <ACGL/OpenGL/Controller/TextureControlFileJPG.hh>
#include <ACGL/OpenGL/Controller/FrameBufferControl.hh>
#include <ACGL/OpenGL/Controller/RenderBufferControl.hh>
#include <ACGL/OpenGL/Controller/VertexBufferControl.hh>
#include <ACGL/OpenGL/Controller/VertexBufferControlFileOBJ.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/ElementArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/VertexBufferObjectControl.hh>
#include <ACGL/OpenGL/Controller/VertexBufferObjectControlFileOBJ.hh>
#endif // ACGL_OPENGL_CONTROLLER_HH
......@@ -3,13 +3,13 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_CONTROLLER_FRAMEBUFFERCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_FRAMEBUFFERCONTROL_HH
#ifndef ACGL_OPENGL_CONTROLLER_FRAMEBUFFEROBJECTCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_FRAMEBUFFEROBJECTCONTROL_HH
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateController.hh>
#include <ACGL/OpenGL/Objects/FrameBuffer.hh>
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
......@@ -18,41 +18,38 @@
namespace ACGL{
namespace OpenGL{
class FrameBufferControl : public Resource::BasicCreateController<FrameBuffer>
class FrameBufferObjectControl : public Resource::BasicCreateController<FrameBufferObject>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
FrameBufferControl(void)
: mWidth(0),
mHeight(0),
mColorAttachments(),
FrameBufferObjectControl(void)
: mColorAttachments(),
mDepthAttachment()
{
mDepthAttachment.name = "";
mDepthAttachment.texture = SharedTexture();
mDepthAttachment.renderBuffer = SharedRenderBuffer();
}
virtual ~FrameBufferControl() {}
virtual ~FrameBufferObjectControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline FrameBufferControl& size (GLsizei _width, GLsizei _height) { mWidth = _width; mHeight = _height; return *this; }
inline FrameBufferControl& depthTexture (const SharedTexture& _pDepthTexture) { mDepthAttachment.texture = _pDepthTexture; return *this; }
inline FrameBufferControl& depthRenderBuffer (const SharedRenderBuffer& _pDepthRenderBuffer) { mDepthAttachment.renderBuffer = _pDepthRenderBuffer; return *this; }
inline FrameBufferObjectControl& depthTexture (const SharedTexture& _pDepthTexture) { mDepthAttachment.texture = _pDepthTexture; return *this; }
inline FrameBufferObjectControl& depthRenderBuffer (const SharedRenderBuffer& _pDepthRenderBuffer) { mDepthAttachment.renderBuffer = _pDepthRenderBuffer; return *this; }
inline FrameBufferControl& colorTexture(const std::string& _name, const SharedTexture& _texture)
inline FrameBufferObjectControl& colorTexture(const std::string& _name, const SharedTexture& _texture)
{
FrameBuffer::Attachment attachment = {_name, _texture, SharedRenderBuffer()};
FrameBufferObject::Attachment attachment = {_name, _texture, SharedRenderBuffer()};
mColorAttachments.push_back(attachment);
return *this;
}
inline FrameBufferControl& colorRenderBuffer(const std::string& _name, const SharedRenderBuffer& _renderBuffer)
inline FrameBufferObjectControl& colorRenderBuffer(const std::string& _name, const SharedRenderBuffer& _renderBuffer)
{
FrameBuffer::Attachment attachment = {_name, SharedTexture(), _renderBuffer};
FrameBufferObject::Attachment attachment = {_name, SharedTexture(), _renderBuffer};
mColorAttachments.push_back(attachment);
return *this;
}
......@@ -61,16 +58,14 @@ public:
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedFrameBuffer create (void);
virtual SharedFrameBufferObject create (void);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLsizei mWidth;
GLsizei mHeight;
FrameBuffer::AttachmentVec mColorAttachments;
FrameBuffer::Attachment mDepthAttachment;
FrameBufferObject::AttachmentVec mColorAttachments;
FrameBufferObject::Attachment mDepthAttachment;
};
} // OpenGL
......
......@@ -92,4 +92,4 @@ protected:
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_CONTROLLER_ShaderProgramObjectControl_HH
#endif // ACGL_OPENGL_CONTROLLER_SHADERPROGRAMOBJECTCONTROL_HH
......@@ -15,19 +15,19 @@
namespace ACGL{
namespace OpenGL{
class StateControl : public Resource::BasicCreateController<Texture>
class StateControl : public Resource::BasicCreateController<State>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
StateControl(
const ConstSharedVertexBuffer& _vertexBuffer,
const ConstSharedVertexBuffer& _frameBuffer,
const ConstSharedVertexBuffer& _shaderProgram,
const ConstSharedVertexBuffer& _viewport)
: mpVertexBuffer(_vertexBuffer),
mpFrameBuffer(_frameBuffer),
const ConstSharedVertexBufferObject& _vertexBufferObject,
const ConstSharedFrameBufferObject& _frameBufferObject,
const ConstSharedShaderProgram& _shaderProgram,
const ConstSharedViewport& _viewport)
: mpVertexBufferObject(_vertexBufferObject),
mpFrameBufferObject(_frameBufferObject),
mpShaderProgram(_shaderProgram),
mpViewport(_viewport)
{}
......@@ -37,10 +37,10 @@ public:
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline StateControl& vertexBuffer (const ConstSharedVertexBuffer& _vertexBuffer) { mpVertexBuffer = _vertexBuffer; return *this; }
inline StateControl& frameBuffer (const ConstSharedFrameBuffer& _frameBuffer) { mpFrameBuffer = _frameBuffer; return *this; }
inline StateControl& shaderProgram (const ConstSharedShaderProgram& _shaderProgram) { mpShaderProgram = _shaderProgram; return *this; }
inline StateControl& viewport (const ConstSharedShaderProgram& _viewport) { mpViewport = _viewport; return *this; }
inline StateControl& vertexBuffer (const ConstSharedVertexBufferObject& _vertexBufferObject) { mpVertexBufferObject = _vertexBufferObject; return *this; }
inline StateControl& frameBuffer (const ConstSharedFrameBufferObject& _frameBufferObject) { mpFrameBufferObject = _frameBufferObject; return *this; }
inline StateControl& shaderProgram (const ConstSharedShaderProgram& _shaderProgram) { mpShaderProgram = _shaderProgram; return *this; }
inline StateControl& viewport (const ConstSharedViewport& _viewport) { mpViewport = _viewport; return *this; }
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
......@@ -48,7 +48,7 @@ public:
public:
virtual SharedState create(void)
{
SharedState state(new State(mpVertexBuffer, mpFrameBuffer, mpShaderProgram, mpViewport));
SharedState state(new State(mpVertexBufferObject, mpFrameBufferObject, mpShaderProgram, mpViewport));
return state;
}
......@@ -57,10 +57,10 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
ConstSharedVertexBuffer mpVertexBuffer;
ConstSharedFrameBuffer mpFrameBuffer;
ConstSharedShaderProgram mpShaderProgram;
ConstSharedViewport mpViewport;
ConstSharedVertexBufferObject mpVertexBufferObject;
ConstSharedFrameBufferObject mpFrameBufferObject;
ConstSharedShaderProgram mpShaderProgram;
ConstSharedViewport mpViewport;
};
} // OpenGL
......
......@@ -3,19 +3,19 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROL_HH
#ifndef ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROL_HH
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateController.hh>
#include <ACGL/OpenGL/Objects/VertexBuffer.hh>
#include <ACGL/OpenGL/Objects/VertexBufferObject.hh>
#include <ACGL/OpenGL/GL.hh>
namespace ACGL{
namespace OpenGL{
class VertexBufferControl : public Resource::BasicCreateController<VertexBuffer>
class VertexBufferObjectControl : public Resource::BasicCreateController<VertexBufferObject>
{
// ==================================================================================================== \/
// ============================================================================================ STRUCTS \/
......@@ -38,29 +38,29 @@ public:
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
VertexBufferControl(void)
: Resource::BasicCreateController<VertexBuffer>(),
VertexBufferObjectControl(void)
: Resource::BasicCreateController<VertexBufferObject>(),
mpElementArrayBuffer(),
mArrayBuffers(),
mAttributeDefines()
{}
virtual ~VertexBufferControl() {}
virtual ~VertexBufferObjectControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline VertexBufferControl& index (const SharedElementArrayBuffer& _elementArrayBuffer) { mpElementArrayBuffer = _elementArrayBuffer; return *this; }
inline VertexBufferControl& data (const SharedArrayBuffer& _vertexBuffer) { mArrayBuffers.push_back(_vertexBuffer); return *this; }
inline VertexBufferObjectControl& index (const SharedElementArrayBuffer& _elementArrayBuffer) { mpElementArrayBuffer = _elementArrayBuffer; return *this; }
inline VertexBufferObjectControl& data (const SharedArrayBuffer& _vertexBuffer) { mArrayBuffers.push_back(_vertexBuffer); return *this; }
inline VertexBufferControl& attribute (const std::string& _name, const std::string& _nameInArray)
inline VertexBufferObjectControl& attribute (const std::string& _name, const std::string& _nameInArray)
{
AttributeDefine a = {_name, mArrayBuffers.size()-1, _nameInArray};
mAttributeDefines.push_back(a);
return *this;
}
inline VertexBufferControl& attribute (const std::string& _name, int_t _bufferID, const std::string& _nameInArray)
inline VertexBufferObjectControl& attribute (const std::string& _name, int_t _bufferID, const std::string& _nameInArray)
{
AttributeDefine a = {_name, _bufferID, _nameInArray};
mAttributeDefines.push_back(a);
......@@ -71,18 +71,18 @@ public:
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedVertexBuffer create(void);
virtual SharedVertexBufferObject create(void);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
SharedElementArrayBuffer mpElementArrayBuffer;
VertexBuffer::ArrayBufferVec mArrayBuffers;
AttributeDefineVec mAttributeDefines;
SharedElementArrayBuffer mpElementArrayBuffer;
VertexBufferObject::ArrayBufferVec mArrayBuffers;
AttributeDefineVec mAttributeDefines;
};
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROL_HH
#endif // ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROL_HH
......@@ -3,42 +3,42 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
#define ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
#ifndef ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROLFILEOBJ_HH
#define ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROLFILEOBJ_HH
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/FileController.hh>
#include <ACGL/Base/Settings.hh>
#include <ACGL/OpenGL/Objects/VertexBuffer.hh>
#include <ACGL/OpenGL/Objects/VertexBufferObject.hh>
#include <ACGL/OpenGL/GL.hh>
namespace ACGL{
namespace OpenGL{
class VertexBufferControlFileOBJ : public Resource::FileController<VertexBuffer>
class VertexBufferObjectControlFileOBJ : public Resource::FileController<VertexBufferObject>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
VertexBufferControlFileOBJ(const std::string& _filename)
: Resource::FileController<VertexBuffer>(_filename, Base::Settings::the()->getFullGeometryPath())
VertexBufferObjectControlFileOBJ(const std::string& _filename)
: Resource::FileController<VertexBufferObject>(_filename, Base::Settings::the()->getFullGeometryPath())
{}
virtual ~VertexBufferControlFileOBJ() {}
virtual ~VertexBufferObjectControlFileOBJ() {}
private:
bool loadOBJ(SharedVertexBuffer& vertexBuffer);
bool loadOBJ(SharedVertexBufferObject& vertexBuffer);
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedVertexBuffer create(void);
virtual bool update(SharedVertexBuffer& vertexBuffer);
virtual SharedVertexBufferObject create(void);
virtual bool update(SharedVertexBufferObject& vertexBuffer);
};
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
#endif // ACGL_OPENGL_CONTROLLER_VERTEXBUFFEROBJECTCONTROLFILEOBJ_HH
......@@ -21,25 +21,30 @@
namespace ACGL{
namespace OpenGL{
typedef Resource::NameManager<ArrayBuffer> ArrayBufferNameManager;
typedef Resource::NameManager<ElementArrayBuffer> ElementArrayBufferNameManager;
typedef Resource::NameManager<FrameBufferObject> FrameBufferObjectNameManager;
typedef Resource::NameManager<RenderBuffer> RenderBufferNameManager;
typedef Resource::NameManager<Shader> ShaderNameManager;
typedef Resource::FileManager<Shader> ShaderFileManager;
typedef Resource::NameManager<ShaderProgram> ShaderProgramNameManager;
typedef Resource::FileManager<ShaderProgram> ShaderProgramFileManager;
typedef Resource::NameManager<Texture> TextureNameManager;
typedef Resource::FileManager<Texture> TextureFileManager;
typedef Resource::NameManager<FrameBuffer> FrameBufferNameManager;
typedef Resource::NameManager<ShaderProgramObject> ShaderProgramObjectNameManager;
typedef Resource::NameManager<RenderBuffer> RenderBufferNameManager;
typedef Resource::NameManager<SharedState> StateNameManager;
typedef Resource::NameManager<VertexBuffer> VertexBufferNameManager;
typedef Resource::FileManager<VertexBuffer> VertexBufferFileManager;
typedef Resource::NameManager<Texture> TextureNameManager;
typedef Resource::FileManager<Texture> TextureFileManager;
typedef Resource::NameManager<ArrayBuffer> ArrayBufferNameManager;
typedef Resource::NameManager<VertexBufferObject> VertexBufferObjectNameManager;
typedef Resource::FileManager<VertexBufferObject> VertexBufferObjectFileManager;
typedef Resource::NameManager<ElementArrayBuffer> ElementArrayBufferNameManager;
} // OpenGL
} // ACGL
......
......@@ -12,14 +12,18 @@
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/Objects/ElementArrayBuffer.hh>
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
#include <ACGL/OpenGL/Objects/RenderBuffer.hh>
#include <ACGL/OpenGL/Objects/Shader.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
#include <ACGL/OpenGL/Objects/ShaderProgramObject.hh>
#include <ACGL/OpenGL/Objects/State.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
#include <ACGL/OpenGL/Objects/FrameBuffer.hh>
#include <ACGL/OpenGL/Objects/RenderBuffer.hh>
#include <ACGL/OpenGL/Objects/VertexBuffer.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/Objects/ElementArrayBuffer.hh>
#include <ACGL/OpenGL/Objects/Uniform.hh>
#include <ACGL/OpenGL/Objects/VertexBufferObject.hh>
#include <ACGL/OpenGL/Objects/Viewport.hh>
#endif // ACGL_OPENGL_OBJECTS_HH
......@@ -3,18 +3,18 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
#define ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
#ifndef ACGL_OPENGL_OBJECTS_FRAMEBUFFEROBJECT_HH
#define ACGL_OPENGL_OBJECTS_FRAMEBUFFEROBJECT_HH
/*
* This FrameBuffer class encapsulates an OpenGL frame buffer object (FBO).
* A FrameBuffer is a target for rendering and thus consists of different "layers":
* This FrameBufferObject class encapsulates an OpenGL frame buffer object (FBO).
* A FrameBufferObject is a target for rendering and thus consists of different "layers":
*
* one or no depthbuffer
* one or no stencilbuffer
* one (OpenGL ES) to many (hardware dependent limit) colorbuffers
*
* These buffers get attached to the FrameBuffer.
* These buffers get attached to the FrameBufferObject.
*
* There exists one system-provided frame buffer object for rendering to the screen
* and optionaly multiple user defined frame buffer objects for offscreen rendering.
......@@ -37,9 +37,9 @@
namespace ACGL{
namespace OpenGL{
class FrameBuffer
class FrameBufferObject
{
ACGL_NOT_COPYABLE(FrameBuffer)
ACGL_NOT_COPYABLE(FrameBufferObject)
// =================================================================================================== \/
// ============================================================================================ STATIC \/
......@@ -69,7 +69,7 @@ public:
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
FrameBuffer(GLsizei _width, GLsizei _height)
FrameBufferObject(void)
: mContext(0),
mDrawBuffers(0),
mColorAttachments(),
......@@ -77,7 +77,7 @@ public:
{
glGenFramebuffers(1, &mContext);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate framebuffer!" << std::endl;
ACGL::Utils::error() << "could not generate FrameBufferObject!" << std::endl;
return;
}
mDepthAttachment.name = "";
......@@ -85,7 +85,7 @@ public:
mDepthAttachment.renderBuffer = SharedRenderBuffer();
}
virtual ~FrameBuffer(void)
virtual ~FrameBufferObject(void)
{
// buffer 0 will get ignored by OpenGL
glDeleteFramebuffers(1, &mContext);
......@@ -105,11 +105,11 @@ public:
public:
int_t getColorAttachmentIndexByName(const std::string& _name) const;
void validate( void ) const;
void validate (void) const;
/**
* Per default a FrameBuffer gets used for read/write operations, but we can
* bind two different FrameBuffers for these operations!
* Per default a FrameBufferObject gets used for read/write operations, but we can
* bind two different FrameBufferObjects for these operations!
*/
inline void bind(GLenum _type = GL_FRAMEBUFFER) const
{
......@@ -131,11 +131,11 @@ public:
openGLRareError();
}
inline bool isFrameBufferComplete(void) const
inline bool isFrameBufferObjectComplete(void) const
{
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
Utils::error() << "Failed to make complete FrameBuffer object: " << (glCheckFramebufferStatus(GL_FRAMEBUFFER)) << std::endl;
Utils::error() << "Failed to make complete FrameBufferObject object: " << (glCheckFramebufferStatus(GL_FRAMEBUFFER)) << std::endl;
return false;
}
return true;
......@@ -209,9 +209,9 @@ protected:
Attachment mDepthAttachment; // depth and stencil are combined
};
ACGL_SHARED_TYPEDEF(FrameBuffer)
ACGL_SHARED_TYPEDEF(FrameBufferObject)
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
#endif // ACGL_OPENGL_OBJECTS_FRAMEBUFFEROBJECT_HH
......@@ -61,7 +61,7 @@ public:
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline const ConstSharedShaderProgram& getShaderProgram (void) const { return mpShaderProgram; }
inline const ConstSharedShaderProgram& getShaderProgram (void) const { return mpShaderProgram; }
inline const UniformAttachmentVec& getUniformAttachments (void) const { return mUniformAttachments; }
inline const UniformTextureAttachmentVec& getUniformTextureAttachments (void) const { return mUniformTextureAttachments; }
......@@ -105,4 +105,4 @@ ACGL_SHARED_TYPEDEF(ShaderProgramObject)
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_OBJECTS_ShaderProgramObject_HH
#endif // ACGL_OPENGL_OBJECTS_SHADERPROGRAMOBJECT_HH
......@@ -16,8 +16,8 @@
#include <ACGL/Base/Macros.hh>
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Objects/VertexBuffer.hh>
#include <ACGL/OpenGL/Objects/FrameBuffer.hh>
#include <ACGL/OpenGL/Objects/VertexBufferObject.hh>
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
#include <ACGL/OpenGL/Objects/Viewport.hh>
......@@ -33,15 +33,15 @@ class State
private:
struct AttributeMapping
{
int arrayBufferID;
int vertexBufferAttribute;
int shaderProgramAttribute;
int_t arrayBufferID;
int_t vertexBufferObjectAttribute;
int_t shaderProgramAttributeLocation;
};
struct FragmentDataMapping
{
int frameBufferColorAttachment;
int shaderProgramFragmentData;
int_t frameBufferObjectColorAttachment;
int_t shaderProgramFragmentDataLocation;
};
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
......@@ -54,12 +54,12 @@ private:
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
State(ConstSharedVertexBuffer _vertexBuffer,
ConstSharedFrameBuffer _frameBuffer,
State(ConstSharedVertexBufferObject _VertexBufferObject,
ConstSharedFrameBufferObject _FrameBufferObject,
ConstSharedShaderProgram _shaderProgram,
ConstSharedViewport _viewport)
: mpVertexBuffer(_vertexBuffer),
mpFrameBuffer(_frameBuffer),
: mpVertexBufferObject(_VertexBufferObject),
mpFrameBufferObject(_FrameBufferObject),
mpShaderProgram(_shaderProgram),
mpViewport(_viewport),
mAttributeMappings(),
......@@ -79,34 +79,47 @@ public:
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline ConstSharedVertexBuffer getVertexBuffer (void) const { return mpVertexBuffer; }
inline ConstSharedFrameBuffer getFrameBuffer (void) const { return mpFrameBuffer; }
inline ConstSharedShaderProgram getShaderProgram (void) const { return mpShaderProgram; }
inline ConstSharedViewport getViewport (void) const { return mpViewport; }
inline ConstSharedVertexBufferObject getVertexBufferObject (void) const { return mpVertexBufferObject; }
inline ConstSharedFrameBufferObject getFrameBufferObject (void) const { return mpFrameBufferObject; }
inline ConstSharedShaderProgram getShaderProgram (void) const { return mpShaderProgram; }
inline ConstSharedViewport getViewport (void) const { return mpViewport; }
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
void useViewport (void);
void enableVertexBufferObject (void);
void bindFrameBufferObject (void);
void disableVertexBufferObject (void);
void updateMappings (void);
inline void validate (void) const
{
mpFrameBuffer->validate();
mpVertexBuffer->validate();
mpFrameBufferObject->validate();
mpVertexBufferObject->validate();
}
void useViewport (void);
void enableVertexBuffer (void);
void bindFrameBuffer (void);
void disableVertexBuffer (void);
void updateMappings (void);
void render (void);
inline void draw(void)
{
mpVertexBufferObject->draw();
}
inline void render(void)
{
useViewport();
bindFrameBufferObject();