Ok so I got rid of that color unpack buffer exception thing with your line of code, but now I’m facing another exception. I’ll show you the code, then the exception.
The code:
//INIT FBO
//create a blank texture
int texture = glGenTextures();
//bind the texture, all future texture calls will modify this texture
glBindTexture(GL_TEXTURE_2D, texture);
//give an empty image to OpenGL (the last “0”)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, BufferUtils.createByteBuffer(800*600));
//filtering?
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//create the frame buffer!
frameBuffer = glGenFramebuffers();
//bind the framebuffer, all future framebuffer calls will modify this buffer
glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
//set "texture" to color attachment #0
//glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, GL_TEXTURE_2D, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
//specify which color attachment the frame buffer will use
int drawBuffer = GL_COLOR_ATTACHMENT0;
glDrawBuffers(drawBuffer);
The exception:
Exception in thread “main” java.lang.IllegalArgumentException: Number of remaining buffer elements is 480000, must be at least 1440000. Because at most 1440000 elements can be returned, a buffer with at least 1440000 elements is required, regardless of actual returned element count
The exception occurs at this line:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, BufferUtils.createByteBuffer(800*600));
Which just happens to be the line you gave me.
Any help?