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

Hard-code internal noise texture format for GL Core profiles #806

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/libprojectM/Renderer/MilkdropNoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
#include <chrono>
#include <random>

// Missing in macOS SDK. Query will most certainly fail, but then use the default format.
#ifndef GL_TEXTURE_IMAGE_FORMAT
#define GL_TEXTURE_IMAGE_FORMAT 0x828F
#endif

namespace libprojectM {
namespace Renderer {

Expand Down Expand Up @@ -103,16 +98,12 @@ auto MilkdropNoise::HighQualityVolume() -> std::shared_ptr<Texture>
auto MilkdropNoise::GetPreferredInternalFormat() -> int
{
#ifndef USE_GLES
// Query preferred internal texture format. GLES 3 only supports GL_RENDERBUFFER here, no texture targets.
// That's why we use GL_BGRA as default, as this is the best general-use format according to Khronos.
GLint preferredInternalFormat{GL_BGRA};
glGetInternalformativ(GL_TEXTURE_2D, GL_RGBA8, GL_TEXTURE_IMAGE_FORMAT, sizeof(preferredInternalFormat), &preferredInternalFormat);
// We use GL_BGRA, as this is the best general-use format according to Khronos.
return GL_BGRA;
#else
// GLES only supports GL_RGB and GL_RGBA, so we always use the latter.
GLint preferredInternalFormat{GL_RGBA};
return GL_RGBA;
#endif

return preferredInternalFormat;
}

auto MilkdropNoise::generate2D(int size, int zoomFactor) -> std::vector<uint32_t>
Expand Down
Loading