mirror of
https://github.com/open-goal/jak-project
synced 2026-06-29 19:42:41 -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   
27 lines
747 B
GLSL
27 lines
747 B
GLSL
#version 410 core
|
|
|
|
layout (location = 0) in vec3 position_in;
|
|
layout (location = 1) in vec4 rgba_in;
|
|
layout (location = 2) in vec3 tex_coord_in;
|
|
layout (location = 3) in uvec4 byte_info;
|
|
|
|
|
|
out vec4 fragment_color;
|
|
out vec3 tex_coord;
|
|
out float fog;
|
|
|
|
// putting all texture info stuff here so it's easier to copy-paste
|
|
flat out uvec2 tex_info;
|
|
|
|
void main() {
|
|
gl_Position = vec4((position_in.x - 0x8000) / 0x1000,
|
|
-(position_in.y - 0x8000) / 0x800,
|
|
position_in.z / 0x800000 - 1., 1.0);
|
|
// scissoring area adjust
|
|
gl_Position.y *= SCISSOR_ADJUST;
|
|
fragment_color = vec4(rgba_in.x, rgba_in.y, rgba_in.z, rgba_in.w * 2.);
|
|
tex_coord = tex_coord_in;
|
|
tex_info = byte_info.xy;
|
|
fog = 255 - byte_info.z;
|
|
}
|