Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: OpenGL ES 2.0, Polygon Offset ignored on some devices

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    7

    Angry OpenGL ES 2.0, Polygon Offset ignored on some devices

    Hi! Sorry for my English)

    Have trouble with one device - Huawei Ascend P6 with Android 4.4.2.
    I set polygon offset, but on rendering it just ignored, frames look like polygon offset turned off. On many another devices with android 4-7 the same program works correctly, problems only on Huawei P6. glIsEnebled(GL_POLYGON_OFFSET_FILL) return true, tried to use different unit and factor values, but its not change anything. Is that possible that polygon offset does not realize in GPU? Is there any way to detect this problem in runtime? Or maybe for some devices i have to do smth else glEnable?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,570
    So you're enabling GL_POLYGON_OFFSET_FILL and calling glPolygonOffset() with different sets of values, right? (Sounds like it.)

    On this device/config, are you sure you have a depth buffer, does it have the same bit depth as on other devices, is your pipeline state set up to write/test depth? And I assume you're not using EXT_polygon_offset_clamp, right?

    What are you seeing? Do you see depth fighting?

    Could be that polygon offset is just broken in the Vivante GC4000 GPU drivers on that 2013 phone (wouldn't surprise me; it's not one of the more common mobile GPU brands), but I'd do some thorough checking before concluding that. Since it seems to work everyplace else, that does suggest the problem is at least specific to your platform/config.

    You might also consider posting a question to some dev forums which talk about issues with Vivante's OpenGL ES drivers. I'm not sure where that is for sure, but check out: https://community.nxp.com/ and https://community.freescale.com/community/imx for starters.

    If needed, you can sort of emulate polygon offset with projection matrix tricks. But make sure you really need to do that first.
    Last edited by Dark Photon; 01-05-2018 at 06:52 AM.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    https://www.khronos.org/registry/Ope...onOffset.xhtml

    Polygon offset is allowed be implementation-dependent. You can't rely on it working the same on all devices.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    7
    Thanks for ypor answers!

    Quote Originally Posted by mhagain View Post
    https://www.khronos.org/registry/Ope...onOffset.xhtml
    Polygon offset is allowed be implementation-dependent. You can't rely on it working the same on all devices.
    Where does this noted in specification? Could you quote, pls?

    Quote Originally Posted by Dark Photon View Post
    So you're enabling GL_POLYGON_OFFSET_FILL and calling glPolygonOffset() with different sets of values, right? (Sounds like it.)

    On this device/config, are you sure you have a depth buffer, does it have the same bit depth as on other devices, is your pipeline state set up to write/test depth? And I assume you're not using EXT_polygon_offset_clamp, right?
    Yes. When i draw borders i just use glPolygonOffset(1f,1f)< for exmaple. Not usibg extensions.

    Quote Originally Posted by Dark Photon View Post
    What are you seeing? Do you see depth fighting?
    I draw roofs and waals of building with some offset(-2,-2 on another devices enough) and next draw border without offset(as i can see, there is no offset for lines in openGL ES 2.0). But most of borders are disappearing in polygons. If i use DepthFunc gl_lequal its look better, whatever some borders not visibale. Example

    Quote Originally Posted by Dark Photon View Post
    Could be that polygon offset is just broken in the Vivante GC4000 GPU drivers on that 2013 phone (wouldn't surprise me; it's not one of the more common mobile GPU brands), but I'd do some thorough checking before concluding that. Since it seems to work everyplace else, that does suggest the problem is at least specific to your platform/config.
    I think you are right. Found another device with the same chip(K3V2, Huawei Honor 3). It have the same problem... But i hav not idea what do what to do whis

    I think about emulating polygon offset whit MVP matrix or shaders, but it will reduce productivity, dont want to do that...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screenshot_2018-01-09-11-22-20.jpg 
Views:	40 
Size:	14.2 KB 
ID:	2592  

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    Quote Originally Posted by restangel View Post
    Where does this noted in specification? Could you quote, pls?
    If we look for occurrances of the word "implementation" on the link I gave you, we see:
    units

    Is multiplied by an implementation-specific value to create a constant depth offset
    And:
    r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation
    The full OpenGL 2.0 specification is at https://www.khronos.org/registry/Ope...l_spec_2.0.pdf and on page 59 we read:
    ...and units scales an implementation-dependent constant that relates to the usable resolution of the depth buffer.
    And:
    The minimum resolvable difference r is an implementation-dependent constant.

  6. #6
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    7
    Oh, i had understood you in wrong way, sorry I see that constants can be different on another devices, but there is full ignoring of polygon offset. I tried very big values, as +-10000, but it changed nothing. By the way, on this devise depth buffer bits is 16 instead of 24. I had an idea that unit and/or factor values depends on diff between far and near, i use 100000 and 50, but when i change it to 1000 anf 50 it didnt change anything again

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    Quote Originally Posted by restangel View Post
    Oh, i had understood you in wrong way, sorry I see that constants can be different on another devices, but there is full ignoring of polygon offset.
    0 is a valid value.

  8. #8
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    7
    Quote Originally Posted by mhagain View Post
    0 is a valid value.
    Maybe, but it does not maky sence... How can we detect that is 0 there? Why do other 3D-games and programms works correctly on the same device? Thay dont use polygon offset? Its hard to believe it...

    Enable anti-aliasing. Picture looks much better, but somewhere i can see that polygon offset doesnt work. Borders that i show in screenshot before still invisible, for example
    Last edited by restangel; 01-10-2018 at 01:40 AM.

  9. #9
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,007
    Quote Originally Posted by restangel View Post
    Maybe, but it does not maky sence... How can we detect that is 0 there? Why do other 3D-games and programms works correctly on the same device? Thay dont use polygon offset?
    It's not a particularly widely-used feature. It's not necessary unless you have surfaces which are close relative to the depth buffer resolution (the distance to the near plane affects this).

    If you're attaching an object to a surface, removing the portion of the surface behind the object (re-tessellating the modified surface) will avoid depth fighting between the object and the surface.

  10. #10
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    7
    Quote Originally Posted by GClements View Post
    If you're attaching an object to a surface, removing the portion of the surface behind the object (re-tessellating the modified surface) will avoid depth fighting between the object and the surface.
    Im afraid its impossible to remove portion of surface behind the line, and its very hard operation if there another polygons on surface... I think that not a good idea

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •