Basic Image AlgorithmS Library
2.8.0
|
This file contains the header for a class template. More...
#include <OpenGLFramework/SpecializedBatches/TemplateSpecializedBatch.hh>
Public Types | |
enum | ProcessingScheme { myProcessingScheme =0, myOtherProcessingScheme } |
Public Member Functions | |
void | Execute () |
Configures GL and issues a "rendering" on the GPU. More... | |
TemplateSpecializedBatch () | |
Calls when appropriate Context is available. | |
void | Init (TemplateSpecializedBatch::ProcessingScheme ps) |
This method initializes all necessary GL structures. More... | |
Communication with other GPU work steps | |
void | SetRenderTarget (BIAS::glfRenderTarget *rt) |
Method determines where the results are delivered. More... | |
void | SetViewport (unsigned int viewportWidth, unsigned int viewportHeight, unsigned int viewportOx=0, unsigned int viewportOy=0) |
Method determines the viewport size, which is used in the render target. More... | |
General I/O | |
Textures are a pretty way to exchange information between GPU worksteps. Although some kind of polymorphism is available not all texture object implement the same amount of functionality. I therefore propose to implement the appropriate, specialized interface. | |
void | UploadTextureImage (BIAS::ImageBase &img) |
Some textures will certainly be created internally. More... | |
void | Update () |
It will certainly be necessary to pass non GL specific data to influence the processing. More... | |
Protected Member Functions | |
void | PreExecute_ () |
Is the first call performed by the Execute method called. More... | |
Protected Attributes | |
bool | callPreExecuteFlag_ |
This flag deteremines whether the PreExecute method has to be called or not. More... | |
bool | initialized_ |
Guard for multiple calls to Init(). More... | |
ProcessingScheme | processingScheme_ |
This enum is used to tell the class how it shall behave and setup GL states, it is specified using Init(). More... | |
Batch Assembly | |
BIAS::glfBatch | batch_ |
This is the core implementation that determines how updates to the GL state are handled. More... | |
void | InitBatch_ () |
Connects all data used in GL processing to the batch. More... | |
Geometry Specification | |
BIAS::glfVertexBuffer | vertices_ |
If you want to process something, you will need vertex data! Of course its possible to have it defined and managed outside this class, but here is the general idea. More... | |
BIAS::glfElementBuffer | elements_ |
Element buffers can be suitable are however not mandatory. More... | |
void | InitPrimitiveData_ () |
Creates the associated GL objects and the content of vertices_ and elements_. More... | |
Textures. | |
Various textures exist in opengl however we did not implement them all yet. Whats pretty heavily used is the Texture2D class, which therefore is well implemented... Number of texture matrices and textures, which be handled in a single pass might differ! | |
BIAS::glfTexture2D | textureInTextureUnit0 |
void | InitTextureData_ () |
Creates and initializes the necessary textures. More... | |
void | InitTextureMatrixData_ () |
Creates and initializes the necessary texture matrices. More... | |
Vertex Transformation. | |
GL contains a default vertex processing chain, which requires the specification of an affine transformation matrix, the ModelView matrix, and a Projection Matrix. In the end projected vertices are mapped to a viewport. | |
BIAS::glfMatrix | ModelViewMatrix_ |
BIAS::glfMatrix | ProjectionMatrix_ |
BIAS::glfViewport | viewport_ |
void | InitVertexTransformation_ () |
Create and setup the render matrices and the viewport. More... | |
Shaders. | |
The GL processing pipeline is made more flexible by the useage of Shaders. You do not have to use shaders. Yet I guess the shaders are the reason for using the OpenGLFramework in the first place... (remove these lines and their usage should you not need them?!) | |
BIAS::glfShaderProgram | shaderProgram_ |
BIAS::glfShader | fragmentShader_ |
void | InitShaders_ () |
Creates and issues initialization of shader execution. More... | |
Per Fragment Operations. | |
In the Gl process ing pipeline after shader application per pixel operations are performed. This are depth test, stencil test, blending ... . Still not all tests are wraped in the OpenGLFramework, but when needed they will. | |
BIAS::glfDepthBufferMode | depthTest_ |
void | InitPerFragmentOperations_ () |
Create and setup the per fragment operations. More... | |
This file contains the header for a class template.
This template shall aid in the usage of the OpenGLFramework, by proposing an implementation scheme to encapsulate OpenGL processings. The whole proposal is based on the Batch concept proposed in the OpenGLFramework. As such the implementation can be emphesised as mantic gathering and maintenance of the necessary stateinformation to execute one or multiple rendering passes.
Definition at line 49 of file TemplateSpecializedBatch.hh.
Enumerator | |
---|---|
myProcessingScheme | |
myOtherProcessingScheme |
Definition at line 51 of file TemplateSpecializedBatch.hh.
TemplateSpecializedBatch::TemplateSpecializedBatch | ( | ) |
Definition at line 32 of file TemplateSpecializedBatch.cpp.
void TemplateSpecializedBatch::Execute | ( | ) |
Configures GL and issues a "rendering" on the GPU.
Definition at line 171 of file TemplateSpecializedBatch.cpp.
References batch_, callPreExecuteFlag_, BIAS::glfBatch::Draw(), initialized_, and PreExecute_().
void TemplateSpecializedBatch::Init | ( | TemplateSpecializedBatch::ProcessingScheme | ps | ) |
This method initializes all necessary GL structures.
Remove unneccesary lines
Definition at line 40 of file TemplateSpecializedBatch.cpp.
References InitBatch_(), initialized_, InitPerFragmentOperations_(), InitPrimitiveData_(), InitShaders_(), InitTextureData_(), InitTextureMatrixData_(), InitVertexTransformation_(), and processingScheme_.
|
protected |
Connects all data used in GL processing to the batch.
Definition at line 157 of file TemplateSpecializedBatch.cpp.
References batch_, depthTest_, elements_, ModelViewMatrix_, ProjectionMatrix_, BIAS::glfBatch::SetDepthBufferMode(), BIAS::glfBatch::SetElementBuffer(), BIAS::glfBatch::SetModelViewMatrix(), BIAS::glfBatch::SetProjectionMatrix(), BIAS::glfBatch::SetShaderProgram(), BIAS::glfBatch::SetTexture(), BIAS::glfBatch::SetVertexBuffer(), BIAS::glfBatch::SetViewport(), shaderProgram_, textureInTextureUnit0, vertices_, and viewport_.
Referenced by Init().
|
protected |
Create and setup the per fragment operations.
Connection to batch_ is performed in InitBatch_().
Definition at line 150 of file TemplateSpecializedBatch.cpp.
References depthTest_, and BIAS::glfDepthBufferMode::SetDepthTest().
Referenced by Init().
|
protected |
Creates the associated GL objects and the content of vertices_ and elements_.
Connection to batch_ is performed in InitBatch_().
Definition at line 62 of file TemplateSpecializedBatch.cpp.
References elements_, BIAS::Primitives::PlainQuad2DWithTexture2D(), and vertices_.
Referenced by Init().
|
protected |
Creates and issues initialization of shader execution.
Connection to batch_ is performed in InitBatch_().
Definition at line 101 of file TemplateSpecializedBatch.cpp.
References BIAS::glfShaderProgram::AttachShader(), BIAS::glfShaderProgram::Create(), BIAS::glfShader::Create(), fragmentShader_, BIAS::glfShaderProgram::Link(), BIAS::glfShaderProgram::SetUniform(), and shaderProgram_.
Referenced by Init().
|
protected |
Creates and initializes the necessary textures.
Connection to batch_ is performed in InitBatch_().
Definition at line 69 of file TemplateSpecializedBatch.cpp.
References BIAS::glfTexture::Create(), BIAS::glfTexture2D::Set(), and textureInTextureUnit0.
Referenced by Init().
|
protected |
Creates and initializes the necessary texture matrices.
Connection to batch_ is performed in InitBatch_().
Definition at line 76 of file TemplateSpecializedBatch.cpp.
Referenced by Init().
|
protected |
Create and setup the render matrices and the viewport.
Connection to batch_ is performed in InitBatch_(). The viewport is not changed here! It is changed by SetViewport method.
Definition at line 82 of file TemplateSpecializedBatch.cpp.
References BIAS::glfMatrix::MakeIdentity(), ModelViewMatrix_, and ProjectionMatrix_.
Referenced by Init().
|
protected |
Is the first call performed by the Execute method called.
This method can be used to update shader parameters etc.
Definition at line 184 of file TemplateSpecializedBatch.cpp.
Referenced by Execute().
void TemplateSpecializedBatch::SetRenderTarget | ( | BIAS::glfRenderTarget * | rt | ) |
Method determines where the results are delivered.
The default is the Screen, which is the same to passing NULL.
Definition at line 144 of file TemplateSpecializedBatch.cpp.
References batch_, and BIAS::glfBatch::SetRenderTarget().
void TemplateSpecializedBatch::SetViewport | ( | unsigned int | viewportWidth, |
unsigned int | viewportHeight, | ||
unsigned int | viewportOx = 0 , |
||
unsigned int | viewportOy = 0 |
||
) |
Method determines the viewport size, which is used in the render target.
Definition at line 134 of file TemplateSpecializedBatch.cpp.
References BIAS::glfViewport::SetOrigin(), BIAS::glfViewport::SetSize(), and viewport_.
void TemplateSpecializedBatch::Update | ( | ) |
It will certainly be necessary to pass non GL specific data to influence the processing.
If changes are made that make a reinitilaization necessary you should work with flags that are evaluated before drawing and are processed when all state changes have been gathered. Use the Update() and the PreExecute_() methods for that.Method evaluates set parameters and adapts the GL state.
Definition at line 192 of file TemplateSpecializedBatch.cpp.
void TemplateSpecializedBatch::UploadTextureImage | ( | BIAS::ImageBase & | img | ) |
Some textures will certainly be created internally.
The UploadTextureContent routines, take care to fill them with content. Currently not all texture targets are fully implemented, therefore I also propose to implement the appropriate interface.
Definition at line 199 of file TemplateSpecializedBatch.cpp.
References textureInTextureUnit0, and BIAS::glfTexture2D::UploadImage().
|
protected |
This is the core implementation that determines how updates to the GL state are handled.
In this all GL state updates are gathered and the update stratgy is implemented here.
Definition at line 156 of file TemplateSpecializedBatch.hh.
Referenced by Execute(), InitBatch_(), and SetRenderTarget().
|
protected |
This flag deteremines whether the PreExecute method has to be called or not.
Definition at line 139 of file TemplateSpecializedBatch.hh.
Referenced by Execute().
|
protected |
Definition at line 270 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitPerFragmentOperations_().
|
protected |
Element buffers can be suitable are however not mandatory.
Definition at line 175 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitPrimitiveData_().
|
protected |
Definition at line 252 of file TemplateSpecializedBatch.hh.
Referenced by InitShaders_().
|
protected |
Guard for multiple calls to Init().
This way one can prohibit conflicts with already setup shader programms, which would start throwing exceptions.
Definition at line 136 of file TemplateSpecializedBatch.hh.
|
protected |
Definition at line 225 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitVertexTransformation_().
|
protected |
This enum is used to tell the class how it shall behave and setup GL states, it is specified using Init().
Definition at line 56 of file TemplateSpecializedBatch.hh.
Referenced by Init().
|
protected |
Definition at line 226 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitVertexTransformation_().
|
protected |
Definition at line 249 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitShaders_().
|
protected |
Definition at line 193 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), InitTextureData_(), and UploadTextureImage().
|
protected |
If you want to process something, you will need vertex data! Of course its possible to have it defined and managed outside this class, but here is the general idea.
Definition at line 172 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and InitPrimitiveData_().
|
protected |
Definition at line 235 of file TemplateSpecializedBatch.hh.
Referenced by InitBatch_(), and SetViewport().