1
1
#include " MilkdropNoise.hpp"
2
2
3
+ #include " Debug.hpp"
3
4
#include " projectM-opengl.h"
4
5
5
6
#include < chrono>
@@ -22,6 +23,7 @@ auto MilkdropNoise::LowQuality() -> std::shared_ptr<Texture>
22
23
glGenTextures (1 , &texture);
23
24
glBindTexture (GL_TEXTURE_2D, texture);
24
25
glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8, 256 , 256 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
26
+ CHECK_GL_ERROR;
25
27
}
26
28
return std::make_shared<Texture>(" noise_lq" , texture, GL_TEXTURE_2D, 256 , 256 , false );
27
29
}
@@ -36,6 +38,7 @@ auto MilkdropNoise::LowQualityLite() -> std::shared_ptr<Texture>
36
38
glGenTextures (1 , &texture);
37
39
glBindTexture (GL_TEXTURE_2D, texture);
38
40
glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8, 32 , 32 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
41
+ CHECK_GL_ERROR;
39
42
}
40
43
41
44
return std::make_shared<Texture>(" noise_lq_lite" , texture, GL_TEXTURE_2D, 32 , 32 , false );
@@ -51,6 +54,7 @@ auto MilkdropNoise::MediumQuality() -> std::shared_ptr<Texture>
51
54
glGenTextures (1 , &texture);
52
55
glBindTexture (GL_TEXTURE_2D, texture);
53
56
glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8, 256 , 256 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
57
+ CHECK_GL_ERROR;
54
58
}
55
59
return std::make_shared<Texture>(" noise_mq" , texture, GL_TEXTURE_2D, 256 , 256 , false );
56
60
}
@@ -65,6 +69,7 @@ auto MilkdropNoise::HighQuality() -> std::shared_ptr<Texture>
65
69
glGenTextures (1 , &texture);
66
70
glBindTexture (GL_TEXTURE_2D, texture);
67
71
glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8, 256 , 256 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
72
+ CHECK_GL_ERROR;
68
73
}
69
74
70
75
return std::make_shared<Texture>(" noise_hq" , texture, GL_TEXTURE_2D, 256 , 256 , false );
@@ -80,6 +85,7 @@ auto MilkdropNoise::LowQualityVolume() -> std::shared_ptr<Texture>
80
85
glGenTextures (1 , &texture);
81
86
glBindTexture (GL_TEXTURE_3D, texture);
82
87
glTexImage3D (GL_TEXTURE_3D, 0 , GL_RGBA8, 32 , 32 , 32 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
88
+ CHECK_GL_ERROR;
83
89
}
84
90
85
91
return std::make_shared<Texture>(" noisevol_lq" , texture, GL_TEXTURE_3D, 32 , 32 , false );
@@ -95,6 +101,7 @@ auto MilkdropNoise::HighQualityVolume() -> std::shared_ptr<Texture>
95
101
glGenTextures (1 , &texture);
96
102
glBindTexture (GL_TEXTURE_3D, texture);
97
103
glTexImage3D (GL_TEXTURE_3D, 0 , GL_RGBA8, 32 , 32 , 32 , 0 , GetPreferredInternalFormat (), GL_UNSIGNED_BYTE, textureData.data ());
104
+ CHECK_GL_ERROR;
98
105
}
99
106
100
107
return std::make_shared<Texture>(" noisevol_hq" , texture, GL_TEXTURE_3D, 32 , 32 , false );
@@ -106,7 +113,9 @@ auto MilkdropNoise::GetPreferredInternalFormat() -> int
106
113
// Query preferred internal texture format. GLES 3 only supports GL_RENDERBUFFER here, no texture targets.
107
114
// That's why we use GL_BGRA as default, as this is the best general-use format according to Khronos.
108
115
GLint preferredInternalFormat{GL_BGRA};
116
+ CHECK_GL_ERROR;
109
117
glGetInternalformativ (GL_TEXTURE_2D, GL_RGBA8, GL_TEXTURE_IMAGE_FORMAT, sizeof (preferredInternalFormat), &preferredInternalFormat);
118
+ CHECK_GL_ERROR;
110
119
#else
111
120
// GLES only supports GL_RGB and GL_RGBA, so we always use the latter.
112
121
GLint preferredInternalFormat{GL_RGBA};
0 commit comments