-
Notifications
You must be signed in to change notification settings - Fork 217
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
Shader type is always invalid #1717
Comments
Looks like in the current version, the shaderId supplied to GVRMaterial constructor is no longer simply kept as a member but gets sent to GVRShaderData's contructor and to GVRShaderManager: If it's copied during the process, then that explains what you observe. |
I wanted to create a function to verify a scene object had the expected shader type, but couldn't work out a way to do this without using reflection. As this was just a debug feature I didn't think it worth raising as an issue, but if yours is a legitimate use case then the ID field of GVRShaderId will need to made publicly accessible, or a utility function within GVRShaderId added to do the check for you. This is what I came up with to do the compare.
|
The GVRShaderManager maintains a list of all of the shaders. Even if you pass your own GVRShaderId to the GVRMaterial constructor, it still uses the shader manager to retrieve the GVRShaderId so they will always match if it is the same shader. It is the actual shader Java class that is used as the key. You can do this to determine if two shaders are the same at the Java level: if (shader1.getTemplate(gvrContext).getClass().equals(shader2.getTemplate(gvrContext).getClass())) |
What is the right way to identify the shader type of a material?
The following code is always logging
INVALID SHADER
The text was updated successfully, but these errors were encountered: