summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-06 15:24:55 -0400
committerpommicket <pommicket@gmail.com>2023-08-06 15:24:55 -0400
commit823815101f55ca0ce67f36867b93934ccdba1953 (patch)
tree2766bf1cf860245445e52aa4626b0005fb701e4d
parent52da64686fb506372fa09ab562915f895cd88cb9 (diff)
silence weird opengl warning
-rw-r--r--main.c7
-rw-r--r--text.c6
-rw-r--r--util.c4
-rw-r--r--util.h1
4 files changed, 6 insertions, 12 deletions
diff --git a/main.c b/main.c
index bc8f7be..3f66d5a 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,4 @@
/*
-TODO:
- - remove rect_translate?
FUTURE FEATURES:
- autodetect indentation (tabs vs spaces)
- robust find (results shouldn't move around when you type things)
@@ -100,11 +98,6 @@ static void APIENTRY gl_message_callback(GLenum source, GLenum type, unsigned in
GLsizei length, const char *message, const void *userParam) {
(void)source; (void)type; (void)id; (void)length; (void)userParam;
if (severity == GL_DEBUG_SEVERITY_NOTIFICATION) return;
- if (strstr(message, "The texture object (0) bound to texture image unit 0 does not have a defined base level and cannot be used for texture mapping")) {
- // shut the fuck up
- // why are you telling me this?
- return;
- }
debug_println("Message from OpenGL: %s.", message);
}
#endif
diff --git a/text.c b/text.c
index ba9212f..60bafd4 100644
--- a/text.c
+++ b/text.c
@@ -344,6 +344,12 @@ void text_render(Font *font) {
glUniform2f(text_u_window_size, gl_window_width, gl_window_height);
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)(3 * ntriangles));
arr_clear(texture->triangles);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ // if i remove this i get
+ // Texture state usage warning: The texture object (0) bound to texture image unit 0 does not have a defined base level and cannot be used for texture mapping
+ // (even with no other draw calls) which is really weird but whatever this is probably good practice anyways.
+ glUseProgram(0);
}
if (font->fallback) {
diff --git a/util.c b/util.c
index 8ba700c..7d5a853 100644
--- a/util.c
+++ b/util.c
@@ -790,10 +790,6 @@ bool rect_contains_point(Rect r, vec2 point) {
return rect_contains_point_v2(r.pos, r.size, point);
}
-Rect rect_translate(Rect r, vec2 by) {
- return rect(vec2_add(r.pos, by), r.size);
-}
-
float rect_x1(Rect r) { return r.pos.x; }
float rect_y1(Rect r) { return r.pos.y; }
float rect_x2(Rect r) { return r.pos.x + r.size.x; }
diff --git a/util.h b/util.h
index 6e243d8..b3d4fba 100644
--- a/util.h
+++ b/util.h
@@ -228,7 +228,6 @@ Rect rect_xywh(float x, float y, float w, float h);
Rect rect_centered(vec2 center, vec2 size);
vec2 rect_center(Rect r);
bool rect_contains_point(Rect r, vec2 point);
-Rect rect_translate(Rect r, vec2 by);
void rect_coords(Rect r, float *x1, float *y1, float *x2, float *y2);
float rect_x1(Rect r);
float rect_y1(Rect r);