# PVRFRAME: glCopyTexImage2D issue

**URL:** <https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069>\
**Category:** PowerVR Insider\
**Tags:** pvrvframe\
**Created:** [May 6, 2011, 7:14am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069 "2011-05-06T07:14:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joepix](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joepix](https://forums.imgtec.com/u/joepix)\
**Post date:** [May 6, 2011, 7:14am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/1 "2011-05-06T07:14:43Z")

</div>

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:  
  
&nbsp; /\* create buffer texture _/  
&nbsp; glBindTexture( GL\_TEXTURE\_2D, tbuffer);  
&nbsp; glTexParameteri( GL\_TEXTURE\_2D, GL\_TEXTURE\_WRAP\_S, GL\_CLAMP\_TO\_EDGE);  
&nbsp; glTexParameteri( GL\_TEXTURE\_2D, GL\_TEXTURE\_WRAP\_T, GL\_CLAMP\_TO\_EDGE);  
&nbsp; glTexParameteri( GL\_TEXTURE\_2D, GL\_TEXTURE\_MIN\_FILTER, GL\_LINEAR);  
&nbsp; glTexParameteri( GL\_TEXTURE\_2D, GL\_TEXTURE\_MAG\_FILTER, GL\_LINEAR);  
&nbsp; glTexImage2D( GL\_TEXTURE\_2D, 0, GL\_RGBA, w, h, 0, GL\_RGBA, GL\_UNSIGNED\_BYTE, NULL);  
&nbsp; glBindTexture( GL\_TEXTURE\_2D, 0);_  
  
  
_&nbsp; /_ assign texture to fbo _/  
&nbsp; glFramebufferTexture2D( GL\_FRAMEBUFFER, GL\_COLOR\_ATTACHMENT0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GL\_TEXTURE\_2D, tbuffer, 0);_  
  
_/_ …rendering code… _/_  
  
_&nbsp; /_ copy result to another texture \*/  
&nbsp; glBindTexture( GL\_TEXTURE\_2D, texture);  
&nbsp; glCopyTexImage2D( GL\_TEXTURE\_2D, 0, GL\_ALPHA, 0, 0, w, h, 0);  
-\> error 501  
  
Thanks in advance,  
joe

---

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://forums.imgtec.com/u/aaron)\
**Post date:** [May 6, 2011, 7:21am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/2 "2011-05-06T07:21:08Z")

</div>

Could you explain why you are copying the texture?  
  
  
  
  
  
Thanks,  
  
  
Aaron.

---

<div class="post-metadata">

**Author:** ![joepix](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joepix](https://forums.imgtec.com/u/joepix)\
**Post date:** [May 6, 2011, 7:39am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/3 "2011-05-06T07:39:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://forums.imgtec.com/u/aaron)\
**Post date:** [May 6, 2011, 8:20am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/4 "2011-05-06T08:20:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacekc](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jacekc](https://forums.imgtec.com/u/jacekc)\
**Post date:** [May 6, 2011, 8:54am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/5 "2011-05-06T08:54:07Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![joepix](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joepix](https://forums.imgtec.com/u/joepix)\
**Post date:** [May 6, 2011, 9:04am UTC](https://forums.imgtec.com/t/pvrframe-glcopyteximage2d-issue/1069/6 "2011-05-06T09:04:26Z")

</div>

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.
