Imagination PowerVR SDK Blog

Polygon offset is not reflected in depth texture


#1

Hello,

In Galaxy S, when a depth texture is attached to GL_DEPTH_ATTACHMENT of framebuffer object, and a polygon was drawn to the frame buffer, polygon offset given in glPolygonOffset does not seem to be reflected to the depth texture.

Output by “adb shell cat /proc/pvr/version” is as follows.
  Version 1.6.16.3947 (release) smdkc110_android
  System Version String: SGX540 S5PC110

This problem may be equal to the following topic.
  https://www.imgtec.com/forum/forum_posts.asp?TID=954

I checked this phenomenon in the following procedures.

 - Specify polygon offset using glPolygonOffset
 - Draw the polygon that is screen coordinate Z=0.0 using glDrawArrays
 - Confirm a pixel value in depth texture

1.0, 2.0, 4.0, 8.0, …, 1.70141e38 were passed to units argument of glPolygonOffset, and a result for each offset was confirmed. However, all the pixel value obtained from the depth buffer were 0 in Galaxy S.

I made the test application that those values were displayed to a screen after these values were converted into a screen z-coordinate.
 
In this image, the left upper number is a z-coordinate corresponding to units=1.0, and a number of the lower right is a z-coordinate corresponding to units=1.70141e38. Because all z-coordinates are 0.0, in GalaxyS, it is thought that polygon offset is not reflected at all.

The result with a certain Adreno 205 device was as follows.
 
In this device, it can be understood that a z-coordinate rises to the place corresponding to units=1024.0.

The source codes of this test application are as follows.
  http://dl.dropbox.com/u/23346852/ticket-701_6/Test701_6-source.zip
  (md5sum=65e6770978fe520a038cc2b76d3ab9d0)

The package which have been built of this application are as follows.
  http://dl.dropbox.com/u/23346852/ticket-701_6/Test701_6-1.0.apk
  (md5sum=2c973f16a6e021818e7586a06c561c7c)

Thanks