Skip to content
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

Does ffgl support WebGL 2 features? #74

Open
wyhinton opened this issue Dec 8, 2021 · 4 comments
Open

Does ffgl support WebGL 2 features? #74

wyhinton opened this issue Dec 8, 2021 · 4 comments

Comments

@wyhinton
Copy link

wyhinton commented Dec 8, 2021

I'm building some shaders using WebGL 2. Does ffgl only support WebGL 1?

i.e will shader code like this work?

#version 300 es
precision highp float;
 
in vec4 v_positionWithOffset;
 
out vec4 outColor;
 
void main() {
  // convert from clipsapce (-1 <-> +1) to color space (0 -> 1).
  vec4 color = v_positionWithOffset * 0.5 + 0.5;
  outColor = color;
}
@MennoVink
Copy link
Collaborator

Technically ffgl does not limit in what kind of opengl context it's being run. It is up to the host to create a context and have it active while processing the plugin.
Resolume creates a 4.1 core context and thus you need to use #version 410 shaders. I have no experience with webgl so i dont know if the driver would be able to load es shaders, it might also depend on which extensions are present.

@wyhinton
Copy link
Author

wyhinton commented Dec 8, 2021

I see. So how do you add gl extensions?

@jorisdejong
Copy link
Contributor

jorisdejong commented Dec 9, 2021

The availability of extensions is determined by the GPU manufacturer. Wikipedia explains it better than I can:

In addition to the features required by the core API, graphics processing unit (GPU) vendors may provide additional functionality in the form of extensions. Extensions may introduce new functions and new constants, and may relax or remove restrictions on existing OpenGL functions. Vendors can use extensions to expose custom APIs without needing support from other vendors or the Khronos Group as a whole, which greatly increases the flexibility of OpenGL

To keep it practical, the code you posted will run fine in a 4.1 context using #version 410, provided you have your own vertex shader passing the values for v_positionWithOffset

@MennoVink
Copy link
Collaborator

GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility and GL_ARB_ES3_compatibility only find widespread support on windows. So yeah it looks like it depends on what your target is. Is there any reason why you wouldn't just port the shader to #version 410?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants