Fixed!
/**
* Start the rendering into the
* frame buffer
*/
public void Enable() {
// save the atributes of the client
GL11.glPushAttrib(GL11.GL_VIEWPORT_BIT);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
// bind the frameBuffer
BindFrameBuffer(iFrameBuffer);
// Set the Buffer Context property
GL11.glViewport(0, 0, iViewPortX, iViewPortY);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, iViewPortX, 0, iViewPortY, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glLoadIdentity();
}
/**
* Stop using the frameBuffer
*/
public void Update() {
// Flush to the screen
//GL11.glFlush();
// unbind the frameBuffer
BindFrameBuffer(0);
// restore the atributes
GL11.glPopAttrib();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
The problem was that in normal mode rendering from (0,0) starting from the top to (Width,Height)
GL11.glOrtho(0, iViewPortX, iViewPortY, 0, 1, -1);
And the correct FBO Rendering is
GL11.glOrtho(0, iViewPortX, 0, iViewPortY, 1, -1);
Rendering to fbo we have to flip the orthogonal. is this a bug or fbo work this way?