OpenGLES 3 Emulator Wide Line

This topic contains 5 replies, has 2 voices, and was last updated by  chris 3 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #31856

    ROm
    Member

    It seems that when creating the GL context the emulator is initializing a standard OpenGL 3.0 context. An error is generated when using glLineWidth > 1. Since wide lines are back in GL 3.1, and since most GLES3 functionalities are present in GL 3.3, wouldn’t it make sense that the emulator initialize an OpenGL 3.3 context instead of 3.0? It is relatively safe to request a 3.3 since its is now supported on all platform at this point including all MACs built after mid 2010. I would love to see this fix in the next revision since my application is greatly relying on wide lines for color picking and 3d manipulators. In the mean time is there any work around that I can use in order to be able to use wide lines?

    #39088

    chris
    Moderator

    Hi ROm

    On OSX, PVRVFrame simply requests the highest OpenGL version available, so if the system supports OpenGL 3.3 then that’s what it should be using. I’m not sure your glLineWidth issue is related to this. Can you give more information about the error? What’s the error code/message and is it reported by glLineWidth itself or some other operation?

    #39089

    ROm
    Member

    The code to test:

    GLenum err = glGetError();

    printf( "start(%d)n", err );

    glLineWidth( 0.0f );

    err = glGetError();

    printf( "LineWidth=0 (%d)n", err );

    glLineWidth( 1.0f );

    err = glGetError();

    printf( "LineWidth=1 (%d)n", err );

    glLineWidth( 2.0f );

    err = glGetError();

    printf( "LineWidth=2 (%d)n", err );

    glLineWidth( 10.0f );

    err = glGetError();

    printf( "LineWidth=10 (%d)n", err );

    The output (at least on my machine):

    (Info) Hardware profile: None
    (Info) PVRVFrame version 10.0

    start(0)
    (Error) in function: glLineWidth GL: 501 (GL_INVALID_VALUE) VF: A0120 (width is less than 1)
    LineWidth=0 (1281)
    LineWidth=1 (0)
    (Error) in function: glLineWidth GL: 501 (GL_INVALID_VALUE) VF: 501 (invalid value)
    LineWidth=2 (1281)
    (Error) in function: glLineWidth GL: 501 (GL_INVALID_VALUE) VF: 501 (invalid value)
    LineWidth=10 (1281)
    #39090

    chris
    Moderator

    Hi ROm

    It seems you have it backwards – wide lines were actually deprecated in OpenGL 3.1, so you’ll have to roll your own.

    #39091

    ROm
    Member

    Fair enough… But how can I “roll my own” without geometry shader? Converting the line points to a triangle strip is easy but how can I simulate in the vertex/fragment shader the same behavior that GL_LINES use to be draw on screen? I would definitely appreciate a workaround on this asap…

    #39092

    chris
    Moderator

    A purely shader-based approach won’t be possible. You’ll need to manually extrude the lines and render the resulting polygons. It gets a bit tricky if you want antialiasing and line joins but at least this way they will work reliably on all devices.

    https://www.mapbox.com/blog/drawing-antialiased-lines/
    https://cesiumjs.org/2013/04/22/Robust-Polyline-Rendering-with-WebGL/

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.