Imagination PowerVR SDK Blog

PVRFRAME: glCopyTexImage2D issue

pvrvframe

#1

Hello,

I cant make glCopyTexImage2D working under pvrframe (build 2.08.28.0607, windows 7 x64, catalyst 11.4), I’m trying to copy pixels from a FBO and it always fails and returns error 501, the log is:
"In glCopyTexImage2D error: 501 (GL_INVALID_VALUE) : (null)"
I dont think the problem comes from my code as it is working with some other GLES wrappers:

  /* create buffer texture /
  glBindTexture( GL_TEXTURE_2D, tbuffer);
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
  glBindTexture( GL_TEXTURE_2D, 0);


  /
assign texture to fbo /
  glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                          GL_TEXTURE_2D, tbuffer, 0);

/
…rendering code… /

  /
copy result to another texture */
  glBindTexture( GL_TEXTURE_2D, texture);
  glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, w, h, 0);
-> error 501

Thanks in advance,
joe




#2

Could you explain why you are copying the texture?





Thanks,


Aaron.



#3

I’m copying the texture because it’s not possible to directly render to a GL_ALPHA texture using fbo (according to GL ES 2 specifications). I could use a RGBA texture, but I try to limit texture memory consumption.


#4

Ah, the old speed vs size trade-off. I’d suggest at least making the copy step a build option so you can test both (on a real device, PVRVFrame performance doesn’t reflect device performance), in case find you see a performance boost significant enough to outweigh the memory saving.





The PVRVFrame error you reported will be investigated.


#5

Is it possible that you send us (devtech@imgtec.com) narrowed example/complete code demonstraiting  that problem?

Thanks



#6

The code is actually part of a large project, I will try to reproduce the problem with a simple code that I could send you, just need to find some time.