25 #include <OpenGLFramework/SpecializedBatches/TemplateSpecializedBatch.hh>
26 #include <OpenGLFramework/Utils/Primitives.hh>
33 processingScheme_(myProcessingScheme),
35 callPreExecuteFlag_(true)
43 BIASWARN(
"[TemplateSpecializedBatch] : Aready initilized!");
105 string fragmentProgram =
106 "uniform sampler2D image;"
109 " vec4 color = texture2D(image, gl_TexCoord[0]);"
111 " gl_FragColor.r = color.g;"
112 " gl_FragColor.g = color.b;"
113 " gl_FragColor.b = color.r;"
114 " gl_FragColor.a = color.a;"
135 unsigned int viewportHeight,
136 unsigned int viewportOx,
137 unsigned int viewportOy)
188 BIASWARN(
"this implementation still contains example-code!");
void SetVertexBuffer(const glfVertexBuffer *vertexBuffer)
Sets the vertex buffer.
void InitPerFragmentOperations_()
Create and setup the per fragment operations.
void SetModelViewMatrix(const glfMatrix *matrix)
Sets the modelview matrix.
void PreExecute_()
Is the first call performed by the Execute method called.
void Create()
Creates the shader program.
void SetUniform(const std::string &varName, float value)
void InitVertexTransformation_()
Create and setup the render matrices and the viewport.
void Link()
Links the attached shaders.
void AttachShader(const glfShader &shader)
Attaches a shader to the program.
void Create()
Creates the texture but does not upload any data yet.
void SetDepthBufferMode(const glfDepthBufferMode *depthBufferMode)
Sets the depth buffer mode.
void Create(GLenum type)
Creates the shader without the GLSL source code, use other Create() methods to upload source afterwar...
void Draw()
Draws the batch.
BIAS::glfMatrix ProjectionMatrix_
void InitBatch_()
Connects all data used in GL processing to the batch.
BIAS::glfElementBuffer elements_
Element buffers can be suitable are however not mandatory.
void UploadImage(const BIAS::ImageBase &image, GLenum internalFormat=0, int mipmap=0)
Uploads a BIAS::Image to a mipmap of the texture.
BIAS::glfViewport viewport_
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.
void UploadTextureImage(BIAS::ImageBase &img)
Some textures will certainly be created internally.
void SetViewport(const glfViewport *viewport)
Sets the viewport.
BIAS::glfTexture2D textureInTextureUnit0
void Execute()
Configures GL and issues a "rendering" on the GPU.
bool initialized_
Guard for multiple calls to Init().
bool callPreExecuteFlag_
This flag deteremines whether the PreExecute method has to be called or not.
BIAS::glfBatch batch_
This is the core implementation that determines how updates to the GL state are handled.
BIAS::glfVertexBuffer vertices_
If you want to process something, you will need vertex data! Of course its possible to have it define...
BIAS::glfShaderProgram shaderProgram_
void SetTexture(const glfTexture *texture, int textureUnit)
Sets the texture of a texture unit.
BIAS::glfDepthBufferMode depthTest_
void InitTextureData_()
Creates and initializes the necessary textures.
BIAS::glfShader fragmentShader_
void InitShaders_()
Creates and issues initialization of shader execution.
void SetRenderTarget(const glfRenderTarget *renderTarget)
Sets the render target.
static void PlainQuad2DWithTexture2D(BIAS::glfVertexBuffer &vb, BIAS::glfElementBuffer &eb, bool flip=false)
Vertex Order: 3–2 | | 0–1 .
void SetShaderProgram(const glfShaderProgram *shaderProgram)
Sets the shader program.
void Init(TemplateSpecializedBatch::ProcessingScheme ps)
This method initializes all necessary GL structures.
void SetRenderTarget(BIAS::glfRenderTarget *rt)
Method determines where the results are delivered.
void SetDepthTest(bool enable)
Sets whether to use depth buffer tests.
void SetSize(int width, int height)
Sets the size of the viewport in pixel coordinates.
void Update()
It will certainly be necessary to pass non GL specific data to influence the processing.
void SetProjectionMatrix(const glfMatrix *matrix)
Sets the projection matrix.
void Set(GLenum minFilter=GL_NEAREST, GLenum magFilter=GL_NEAREST, GLenum wrapS=GL_CLAMP, GLenum wrapT=GL_CLAMP, GLint textureNr=GL_TEXTURE0)
Convenience wrapper.
void SetOrigin(int x, int y)
Sets the position of the upper-left corner of the viewport in pixel coordinates.
void SetElementBuffer(const glfElementBuffer *elementBuffer)
Sets the element buffer.
void InitTextureMatrixData_()
Creates and initializes the necessary texture matrices.
BIAS::glfMatrix ModelViewMatrix_
Interface for render targets.
This is the base class for images in BIAS.
ProcessingScheme processingScheme_
This enum is used to tell the class how it shall behave and setup GL states, it is specified using In...
TemplateSpecializedBatch()
void InitPrimitiveData_()
Creates the associated GL objects and the content of vertices_ and elements_.