I need your help again. I wanna use Frame Buffer Object bigger than the Screen size. When I do it as below FBO size 1024 x 1024 is cut off from the top in resolution 1024 x 768. I couldn't find the solution on my own - that's why I'm asking.
First part of code is the way I create FBO, I do the rendering between activate, and deactivate. Later I use texture.
What am I doing wrong?
What is the fastest way to clear Frame Buffer Object for reuse?
public FrameBufferObject(int width, int height) {
this.width = width;
this.height = height;
texture = glGenTextures();
frameBufferObject = GL30.glGenFramebuffers();
activate();
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_BYTE, BufferUtils.createByteBuffer(4 * width * height));
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
deactivate();
}
public void activate() {
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferObject);
}
public void deactivate();
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
OpenGL settings:
private static void initializeOpenGL() {
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_MULTISAMPLE);
glEnable(GL_BLEND);
glEnable(GL_SCISSOR_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glClearColor(0, 0, 0, 0);
}