# Depth texture with GL\_REPEAT

**URL:** <https://forums.imgtec.com/t/depth-texture-with-gl-repeat/1139>\
**Category:** PowerVR Insider\
**Created:** [July 26, 2011, 7:19am UTC](https://forums.imgtec.com/t/depth-texture-with-gl-repeat/1139 "2011-07-26T07:19:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pencyot3](https://avatars.discourse-cdn.com/v4/letter/p/b3f665/32.png) [@pencyot3](https://forums.imgtec.com/u/pencyot3)\
**Post date:** [July 26, 2011, 7:19am UTC](https://forums.imgtec.com/t/depth-texture-with-gl-repeat/1139/1 "2011-07-26T07:19:55Z")

</div>

When depth texture is used with GL\_REPEAT, texture2D() may fetch black value.  
This issue did not occur in GL\_CLAMP\_TO\_EDGE.  
  
I tested it in Galaxy S (SC-02B Android 2.3.3 GINGERBREAD.OMKE3).  
  
I made the texture object as follows. All the elements of _pixels_ are 0x7777 then.  
  
&nbsp; glBindTexture( GL\_TEXTURE\_2D, texture );  
&nbsp; glPixelStorei( GL\_UNPACK\_ALIGNMENT, 1 );  
&nbsp; glTexImage2D( GL\_TEXTURE\_2D, 0, GL\_DEPTH\_COMPONENT, 4, 4, 0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GL\_DEPTH\_COMPONENT, GL\_UNSIGNED\_SHORT, pixels );  
  
  
The following image is screenshot in Galaxy S.  
  
 ![](http://dl.dropbox.com/u/23346852/ticket-701_5/Test701_5-galaxy-s.png)  
  
Wrap-mode of texture which an upper triangle uses is GL\_REPEAT. Wrap-mode of texture  
which an lower triangle uses is GL\_CLAMP\_TO\_EDGE.  
  
The source code of the application mentioned above is  
[http://dl.dropbox.com/u/23346852/ticket-701\_5/Test701\_5-source.zip](http://dl.dropbox.com/u/23346852/ticket-701_5/Test701_5-source.zip)  
(md5sum=37b63dff0b9a7646a0c732d62e5284ac)  
  
The APK file of the application is  
[http://dl.dropbox.com/u/23346852/ticket-701\_5/Test701\_5.apk](http://dl.dropbox.com/u/23346852/ticket-701_5/Test701_5.apk)  
(md5sum=45576e74c1da1ab6ca026e0525c0c128)  
  
  
The following image is screenshot in GALAPAGOS 003SH.  
  
 ![](http://dl.dropbox.com/u/23346852/ticket-701_5/Test701_5-galapagos.png)
