Hi,
I need use two different color attachments with different dimensions (NxN and MxM), i’m working with an ATI X600. I get the “1286” GL Error code, i don’t know what error is this.
GLuint tex[2]; // two textures
…
// make two textures (vtx, adj)
glGenTextures(2, &tex[0]);
// initialize texture 1
glBindTexture(TEXTURE_TARGET, tex[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(TEXTURE_TARGET, 0, TEXTURE_TYPE, vImageWidth, vImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
assert(errcheck());
// initialize texture 2
glBindTexture(TEXTURE_TARGET, tex[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(TEXTURE_TARGET, 0, TEXTURE_TYPE, cImageWidth, cImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
assert(errcheck());
…
// gen the FBO
glGenFramebuffersEXT(1, &fb);
assert(errcheck());
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, TEXTURE_TARGET, tex[0], 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, TEXTURE_TARGET, tex[1], 0);
CHECK_FRAMEBUFFER_STATUS()
assert(errcheck());
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
…
// send array data for both textures
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,vImageWidth,0.0,vImageHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,vImageWidth,vImageHeight);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glRasterPos2i(0,0);
glDrawPixels(vImageWidth,vImageHeight,GL_RGBA,GL_FLOAT,vtx);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,cImageWidth,0.0,cImageHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,cImageWidth,cImageHeight);
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
glRasterPos2i(0,0);
glDrawPixels(cImageWidth,cImageHeight,GL_RGBA,GL_FLOAT,adj); // Here!!! crashes the program
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
…
A solution will be create another FBO, but it crashes too, in this case i don’t know if the COLOR_ATTACHMENTS “id” start with 0 or continues with the last used in the first FBO, i.e., last_id+1
yalmar.