-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
[V4.1.x] Fix GL_INVALID_ENUM error in CopyTexture #826
Conversation
Before rendering the first frame, there is no output texture present in a preset, so we can't copy anything and should just skip that step.
1038026
to
9bc89af
Compare
void Texture::CreateEmptyTexture() | ||
auto Texture::Empty() const -> bool | ||
{ | ||
return m_textureId == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was considering checking the texture id instead of the target. I ended up checking the target, because that was the value that directly triggered the GL_INVALID_ENUM
. Would it be worth it to check both values ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard, just noticed, this is the backport. We should not do anything different here anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_target
is, except for the volume noise textures, always set to GL_TEXTURE_2D
, even if the texture is empty. I think "target" is a misleading name for the texture's dimensionality, but it's how OpenGL calls it.
What triggered the error was actually m_textureId
being zero because the actual texture wasn't initialized at the point when it was first used (copying the previous frame texture into the new preset - naturally, there's no previous texture right after init).
Works great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have anything to add here, don't have much of an idea of what's going on. Adding some comments on the changed lines about why we need these checks or why New instead of Empty is preferable would be grand
I took this consideration because the previous name would be misleading now. "Empty", in the new naming context, means there is no actual texture allocated at all, e.g. the texture object is 0 or "empty", like a Hope this clears it up a bit. The Doxygen comments in the header file also reflect this. |
Bumped libprojectM to v4.1.2 as well. Will create a bugfix release as this issue can break integrations checking for GL errors, e.g. GStreamer.