News for hackers. Stuff that matters.
Re:Show HN: The full source code and assets for my custom ga... by fwsgonzo on Monday July 10, 2023 @04:07PM (#36672219)
I'm also making a game from scratch and reinventing wheels. What is the processing that you are doing for GLES? I see the GLSL_PREPROCESS in the GLSL.
Re:Show HN: The full source code and assets for my custom ga... by mknsri on Monday July 10, 2023 @04:08PM (#36672236)
I wanted to include common code for all shaders in a simple way, but I was too lazy write a proper parser. So instead I used the C++ preprocessor and macros to include things from common shader code and combine them in the build step.
Re:Show HN: The full source code and assets for my custom ga... by corysama on Monday July 10, 2023 @07:02PM (#36674193)
FYI: https://docs.gl/es2/glShaderSource takes an array of strings and just internally appends them together. So, rather than trying to #include common code for all my shaders, I just pass a common_code_string and a shader_specific_code_string every time.
Re:Show HN: The full source code and assets for my custom ga... by mknsri on Tuesday July 11, 2023 @12:49AM (#36676533)
I could have definitely used that and I'm surprised I didn't realise it when researching how to include shader code. Luckily my setup required very little work and with my system I could share snippets between GLES and GL.