mirror of
https://github.com/open-goal/jak-project
synced 2026-08-09 18:58:50 -04:00
40e2f113e6
## Problem OpenGOAL uses OpenGL 4.3. Apple stopped upgrading OpenGL after 4.1, so the way OpenGOAL currently works will never be playable on Macs using OpenGL. ## Solution Luckily, downgrading to OpenGL 4.1 is not a huge change (at least it doesn't seem like it to my untrained eyes). ## Changes * set hints for OpenGL 4.1 instead of 4.3 for __APPLE__ * skip the OpenGL debugging callback setup for macOS (requires 4.3) * bump down the version string for all shaders * stop using the `binding` layout qualifier in shader code * move the `flat` qualifier first (not sure if this is a 4.1 thing or just Macs being more strict) * don't mix signed and unsigned ints in shaders (not sure if this is a 4.1 thing or just Macs being more strict) * add some hacky CPP to the Shader constructor for binding texture units and bones buffers based on variable names in the shader code ## Results   
28 lines
534 B
GLSL
28 lines
534 B
GLSL
#version 410 core
|
|
|
|
layout (location = 0) in vec2 xy;
|
|
layout (location = 1) in vec2 st;
|
|
|
|
uniform vec4 u_color;
|
|
uniform float u_depth;
|
|
|
|
flat out vec4 fragment_color;
|
|
out vec2 tex_coord;
|
|
|
|
void main() {
|
|
// Calculate color
|
|
vec4 color = u_color;
|
|
color *= 2; // correct
|
|
|
|
fragment_color = color;
|
|
|
|
// Pass on texture coord
|
|
tex_coord = st;
|
|
|
|
// Calculate vertex position
|
|
vec4 position = vec4(xy.x, xy.y, u_depth, 1.0);
|
|
position.xyz = (position.xyz * 2) - 1.0; // convert from [0,1] to clip-space
|
|
|
|
gl_Position = position;
|
|
}
|