-
Notifications
You must be signed in to change notification settings - Fork 124
Initial GLES3 on GLView #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Currently, I'm getting a GLES3 context on Android without any changes. I am enabling GLES3 hint on Angle which should be safe on Desktop, and it should return a GLES2 context if not available anyway. I have added some funcions in nme.gl.Utils to detect "isGLES3compat" (checks for GLES>3.0 or desktop OpenGL>=3.3) and to write source shader code compatible with GLES3 and GLES2 shader languages. On nme_gl_shader_source, some string was added for gles shaders. Now it checks if the shader starts with #v (#version) so it does not includes that string, and now we add it form the HEADER function in nme.gl.Utils Implemented VertexArrays Even GLES3 is enabled it shouldn't affect current behaivor but may need testing. Added NME_NO_GLES3COMPAT flag if revert is needed. please check sample https://github.com/madrazo/nme-opengl-tutorials/tree/master/tutorial02_red_triangle
|
I had not considered Emscripten, but here says
Edit: "isGLES3compat()" checks for WebGL version >=2.0 |
look for WebGL version in nme.gl.Utils and set isGLES3compat if its WebGL 2.0
In Angle, tries GLES3. If it fails, tries again with major=2 (GLES2)
|
this is not working on WinRT |
But needs API 18+
Fixes an infinite loop when Renderer using GLES3 Fails
|
Actually I have a modification on SDL to make this work.... Comment lines [these lines] of SDL_render_gles2.c, funtion GLES2_CreateRenderer |
|
Does this PR need the SDL changes to work? |
|
Yes it does, otherwise you get a GLES2 context I opened a SDL bugzilla here: At least for Angle. I should test in other targets (Android, Emscripten) Also, I'm thinking on add a GL3.hx for the GLES3 functions intead of GL.hx so it's more clear the difference between APIs |
|
Test, added a debug text in tutorial02 to show if it's GLES3 compatible:
|
|
Here is the SDL change native-toolkit/libsdl#11 |
merged and improved from haxenme#496 . Added GL3.hx for GLES3 functions. It is only activated for windows and android because needs testing on other targets (ios, linux, mac, emscripten). Windows angle needs native-toolkit/libsdl#11 , otherwise gets a GLES2 context. Tested with https://github.com/madrazo/nme-opengl-tutorials/tree/master/tutorial02_red_triangle
|
closed for #517 |
Currently, I'm getting a GLES3 context on Android without any changes.
I am enabling GLES3 hint on Angle which should be safe on Desktop, and
it should return a GLES2 context if not available anyway. EDIT: Added a fallback to try again with GLES2 if renderer fails with GLES3.
I have added some funcions in nme.gl.Utils to detect "isGLES3compat()" (checks for
GLES>3.0, WebGL>=2.0, or desktop OpenGL>=3.3), ""isGLES()", and helper functions to write source shader code compatible with GLES3 and GLES2 shader languages. (IN(n), OUT(), OUT_COLOR("color"), HEADER())
On nme_gl_shader_source (OGLExport.cpp), there was a problem that a string was added for GLESshaders.
Now it checks if the shader starts with #v (#version) so it does not includes
that string, and now we add it form the HEADER function in nme.gl.Utils
Implemented VertexArrays "create" and "binding"
Even GLES3 is enabled it shouldn't affect current behaivor but may need
testing. Added NME_NO_GLES3COMPAT flag if revert is needed (can be added as compileflag on ToolkitBuild.xml).
please check sample
https://github.com/madrazo/nme-opengl-tutorials/tree/master/tutorial02_red_triangle
I have tested it on Windows with and without NME_NO_ANGLE and with (and without) forcing the isGLES3compat to false and initial hint with 2 and 3.
Note that the user should be responsible for checking for isGLES3compat(), if still wants to be compatible with GLES2.
Extra: Android data on the availability of GLES3 (over 60% in GLES3.0+GLES3.1)
Related issue: #162