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

Added a new interface for OpenGL objects and added a new constructor for ShaderProgram using it. #7381

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

LunarOlympian
Copy link

@LunarOlympian LunarOlympian commented Apr 11, 2024

Added a new interface which ShaderProgram implements. I also added a constructor to create a ShaderProgram using this interface. Two setters were also added to fill in missing info and allow full functionality.
This should allow shader program's functionality to be made without creating a program using OpenGL as is done with the current constructor setup.
The interface should be able to be implemented into more classes that use OpenGL, though ShaderProgram is the only one that currently implements it.

I have spent many hours I'm never getting back trying to find a way to add support for my own OpenGL shader implementation to work with ShaderProgram, and failed to find a particularly good solution. A short summary of the options I've tried, which all had their own issues:

  • Extending the ShaderProgram class. It would've worked except for the constructor being called.
  • Creating an unsafe instance of Shader program and using bytecode editors to add in a proxy to handle method calls.
  • Reflections to create an instance of ShaderProgram with custom variable assignments.
  • Directly editing the bytecode of a class instance and casting it to ShaderProgram.

LunarOlympian and others added 3 commits April 11, 2024 17:23
Added a constructor to add shaders from existing sources and a blank one just to enable full compatability.
@LunarOlympian LunarOlympian changed the title Added 2 new constructors for ShaderPrograms Added a new interface for OpenGL objects and added a new constructor for ShaderProgram using it. Apr 14, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant