binji / binjgb

Gameboy emulator implemented in C, that also runs in the browser
https://binji.github.io/binjgb/
MIT License
550 stars 62 forks source link

Prepend shader version; avoid deprecated features #17

Closed binji closed 6 years ago

binji commented 6 years ago

OSX seems to want shader version 150, instead of 130. Since we require OpenGL 3, I think it's enough to support 150 and always use the version tag that matches the value returned from GL_SHADING_LANGUAGE_VERSION.

Should fix issue #16.

aconbere commented 6 years ago

texture2D is also deprecated, but otherwise this works.

diff --git a/src/host-ui-simple.c b/src/host-ui-simple.c
index 9e8c381..b1f800e 100644
--- a/src/host-ui-simple.c
+++ b/src/host-ui-simple.c
@@ -49,7 +49,7 @@ static Result host_ui_init(struct HostUI* ui, SDL_Window* window) {
       "uniform vec4 uPalette[4];\n"
       "uniform sampler2D uSampler;\n"
       "void main(void) {\n"
-      "  vec4 color = texture2D(uSampler, vTexCoord);\n"
+      "  vec4 color = texture(uSampler, vTexCoord);\n"
       "  if (uUsePalette != 0) {\n"
       "    color = uPalette[int(clamp(color.x * 256.0, 0.0, 3.0))];\n"
       "  }\n"
binji commented 6 years ago

Oops, thanks! Fixed here.

aconbere commented 6 years ago

Works!