OpenGLES 3 Emulator Wide Line

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?

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?

The code to test:


GLenum err = glGetError();<br />
<br />
printf( "start(%d)n", err );<br />
<br />
glLineWidth( 0.0f );<br />
<br />
err = glGetError();<br />
<br />
printf( "LineWidth=0 (%d)n", err );<br />
<br />
glLineWidth( 1.0f );<br />
<br />
err = glGetError();<br />
<br />
printf( "LineWidth=1 (%d)n", err );<br />
<br />
glLineWidth( 2.0f );<br />
<br />
err = glGetError();<br />
<br />
printf( "LineWidth=2 (%d)n", err );<br />
<br />
glLineWidth( 10.0f );<br />
<br />
err = glGetError();<br />
<br />
printf( "LineWidth=10 (%d)n", err );
```<br />
<br />
The  output (at least on my machine):<br />
<br />

(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)

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.

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…

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/