23GeometryBuffer::GeometryBuffer(int32_t width, int32_t height)
115 renderer->disableCulling(contextIdx);
119 renderer->clear(renderer->CLEAR_COLOR_BUFFER_BIT | renderer->CLEAR_DEPTH_BUFFER_BIT);
124 deferredLightingRenderShader->useProgram(engine);
127 renderer->setTextureUnit(contextIdx, 0);
129 renderer->setTextureUnit(contextIdx, 1);
131 renderer->setTextureUnit(contextIdx, 2);
135 renderer->setTextureUnit(contextIdx, 3);
137 renderer->setTextureUnit(contextIdx, 4);
139 renderer->setTextureUnit(contextIdx, 5);
141 renderer->setTextureUnit(contextIdx, 6);
143 renderer->setTextureUnit(contextIdx, 7);
147 renderer->setTextureUnit(contextIdx, 8);
151 renderer->bindVerticesBufferObject(contextIdx, frameBufferRenderShader->getVBOVertices());
152 renderer->bindTextureCoordinatesBufferObject(contextIdx, frameBufferRenderShader->getVBOTextureCoordinates());
155 renderer->drawTrianglesFromBufferObjects(contextIdx, 2, 0);
158 renderer->unbindBufferObjects(contextIdx);
161 renderer->setTextureUnit(contextIdx, 0);
162 renderer->bindTexture(contextIdx, renderer->ID_NONE);
163 renderer->setTextureUnit(contextIdx, 1);
164 renderer->bindTexture(contextIdx, renderer->ID_NONE);
165 renderer->setTextureUnit(contextIdx, 2);
166 renderer->bindTexture(contextIdx, renderer->ID_NONE);
169 renderer->setTextureUnit(contextIdx, 3);
170 renderer->bindTexture(contextIdx, renderer->ID_NONE);
171 renderer->setTextureUnit(contextIdx, 4);
172 renderer->bindTexture(contextIdx, renderer->ID_NONE);
173 renderer->setTextureUnit(contextIdx, 5);
174 renderer->bindTexture(contextIdx, renderer->ID_NONE);
175 renderer->setTextureUnit(contextIdx, 6);
176 renderer->bindTexture(contextIdx, renderer->ID_NONE);
177 renderer->setTextureUnit(contextIdx, 7);
178 renderer->bindTexture(contextIdx, renderer->ID_NONE);
181 renderer->setTextureUnit(contextIdx, 8);
182 renderer->bindTexture(contextIdx, renderer->ID_NONE);
185 renderer->setTextureUnit(contextIdx, 0);
188 deferredLightingRenderShader->unUseProgram();
191 renderer->enableCulling(contextIdx);
static FrameBufferRenderShader * getFrameBufferRenderShader()
static STATIC_DLL_IMPEXT Renderer * renderer
static STATIC_DLL_IMPEXT Engine * instance
static DeferredLightingRenderShader * getDeferredLightingRenderShader()
int32_t colorBufferTextureId5
void reshape(int32_t width, int32_t height)
Resize the geometry buffer.
void initialize()
Initialize the geometry buffer.
int32_t colorBufferTextureId1
int32_t colorBufferTextureId2
int32_t colorBufferTextureId4
void renderToScreen(Engine *engine)
Render to screen or bound geometry buffer @engine engine.
int32_t colorBufferTextureId3
int32_t geometryBufferTextureId3
void dispose()
Disposes this geometry buffer.
void enableGeometryBuffer()
Enables this geometry buffer to be rendered.
int32_t geometryBufferTextureId2
int32_t depthBufferTextureId
int32_t geometryBufferTextureId1
static void disableGeometryBuffer()
Switches back to non offscreen main frame buffer to be rendered.
Deferred lighint render shader.
Frame buffer render shader.
virtual void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a depth texture.
virtual void setViewPort(int32_t width, int32_t height)=0
Set up viewport parameter.
virtual void updateViewPort()=0
Update viewport.
virtual int32_t createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)=0
Creates a depth buffer texture.
virtual int32_t createGBufferGeometryTexture(int32_t width, int32_t height)=0
Creates a geometry buffer geometry texture.
virtual void disposeTexture(int32_t textureId)=0
Dispose a texture.
virtual void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer geometry texture.
virtual void bindFrameBuffer(int32_t frameBufferId)=0
Enables a framebuffer to be rendered.
virtual void disposeFrameBufferObject(int32_t frameBufferId)=0
Disposes a frame buffer object.
int32_t CONTEXTINDEX_DEFAULT
virtual int32_t createGBufferColorTexture(int32_t width, int32_t height)=0
Creates a geometry buffer color RGBA texture.
virtual int32_t createGeometryBufferObject(int32_t depthBufferTextureId, int32_t geometryBufferTextureId1, int32_t geometryBufferTextureId2, int32_t geometryBufferTextureId3, int32_t colorBufferTextureId1, int32_t colorBufferTextureId2, int32_t colorBufferTextureId3, int32_t colorBufferTextureId4, int32_t colorBufferTextureId5)=0
Creates a geometry frame buffer object.
virtual void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer color RGBA texture.