{"id":20553547,"url":"https://github.com/christianpanov/glcore","last_synced_at":"2025-10-10T03:37:04.423Z","repository":{"id":56762150,"uuid":"304850817","full_name":"ChristianPanov/glcore","owner":"ChristianPanov","description":"No-dependency OpenGL support library, which abstracts the processes of creating buffers and shaders","archived":false,"fork":false,"pushed_at":"2023-04-28T16:48:31.000Z","size":599,"stargazers_count":13,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T11:54:50.583Z","etag":null,"topics":["cpp","cpp-library","glcore","graphics-library","graphics-programming","library","opengl","opengl-library","shaders"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristianPanov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-17T10:17:54.000Z","updated_at":"2025-02-19T18:14:05.000Z","dependencies_parsed_at":"2024-11-16T02:42:26.672Z","dependency_job_id":"e86b8f5d-a829-402c-8f3f-27d73bed1c65","html_url":"https://github.com/ChristianPanov/glcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ChristianPanov/glcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianPanov%2Fglcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianPanov%2Fglcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianPanov%2Fglcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianPanov%2Fglcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristianPanov","download_url":"https://codeload.github.com/ChristianPanov/glcore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianPanov%2Fglcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002620,"owners_count":26083425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp-library","glcore","graphics-library","graphics-programming","library","opengl","opengl-library","shaders"],"created_at":"2024-11-16T02:42:23.173Z","updated_at":"2025-10-10T03:37:04.407Z","avatar_url":"https://github.com/ChristianPanov.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"No-dependency OpenGL support library, which abstracts the processes of creating buffers and shaders\n# Install\n```\ngit clone --recursive https://github.com/ChristianPanov/glcore\n```\n# Design Highlights\n- Very lightweight - ***glcore*** is merely a thin wrapper around the OpenGL functions, except the shader class, which is more than a wrapper. It may be thin, but it's very useful for abstracting the OpenGL state machine logic to a more object-oriented logic\n- No dependencies - ***glcore*** does not enforce any dependencies such as function loaders, by using placeholder functions, which can be replaced with the function loader of choice simply by putting the needed includes in a specific file\n# Features\n- Vertex buffers\n- Vertex buffer layout\n- Index buffers\n- Vertex arrays\n- Shaders\n# Setup\nBecause of the no-dependency nature of ***glcore***, you will need to provide the OpenGL function loader.\\\nTo do that, you will need to locate the ```src/glcore/tweakme``` folder, and open the [***gl_functions.h***](https://github.com/ChristianPanov/glcore/blob/main/glcore/src/glcore/tweakme/gl_functions.h) header file.\\\nFrom there on, it is pretty self explanatory with the comments that are provided in the file.\n# Usage\n## Basic Usage\n```cpp\n#include \"glcore.h\"\n\nint main()\n{\n\tfloat vertices[4][7] = {\n\t\t{ -0.5f, -0.5f, 0.0f, 0.8f, 0.2f, 0.8f, 1.0f },\n\t\t{  0.5f, -0.5f, 0.0f, 0.2f, 0.3f, 0.8f, 1.0f },\n\t\t{  0.5f,  0.5f, 0.0f, 0.8f, 0.8f, 0.2f, 1.0f },\n\t\t{ -0.5f,  0.5f, 0.0f, 0.8f, 0.8f, 0.2f, 1.0f }\n\t};\n\n\tunsigned int indices[2][3] = {\n\t\t{ 0, 1, 2 },\n\t\t{ 0, 2, 3 }\n\t};\n\n\tglcore::vertex_buffer vbo(*vertices, sizeof(vertices));\n\tglcore::index_buffer ibo(*indices, sizeof(indices) / sizeof(int));\n\tglcore::vertex_buffer_layout layout =\n\t{\n\t\t{ glcore::shader_data_type::vec3, \"position\" },\n\t\t{ glcore::shader_data_type::vec4, \"color\" }\n\t};\n\tvbo.set_layout(layout);\n\n\tglcore::vertex_array vao;\n\tvao.add_vertex_buffer(vbo);\n\tvao.set_index_buffer(ibo);\n\n\tglcore::shader_program shaders(\"Basic\", {\n\t\t{ glcore::shader_type::vertex, \"shader_examples/vert.glsl\" },\n\t\t{ glcore::shader_type::fragment, \"shader_examples/frag.glsl\" }\n\t\t});\n\tshaders.bind();\n\n\tshaders.upload_uniform4f(\"u_Color\", 0.2f, 0.3f, 0.8f, 1.0f);\n\n\treturn 0;\n}\n```\n## Vertex buffer layout\nThe vertex buffer layout is declared in a very intuitive way. You provide a shader data type and an identifier name. The shader data types reside in the ```glcore::shader_data_type``` namespace.\n```cpp\nglcore::vertex_buffer_layout layout =\n{\n\t{ glcore::shader_data_type::vec3, \"position\" },\n\t{ glcore::shader_data_type::vec4, \"color\" }\n};\n```\nA vertex buffer layout can either be declared on it's own like in the example above, or can be created as an rvalue directly in the constructor of ```glcore::vertex_buffer```\n```cpp\nglcore::vertex_buffer vbo(*vertices, sizeof(vertices), {\n\t{ glcore::shader_data_type::type::vec3, \"position\" },\n\t{ glcore::shader_data_type::type::vec4, \"color\" }\n});\n```\n## Shaders\nA shader program can be handled in two different ways. You can have separate shader files for each type of shader, or you can have one single shader file.\n### Single file\nWith the single file approach, you only need to provide the file path and a name for the shader program. If you don't provide a name for the shader program, ***glcore*** will automatically set the name to be the name of the file.\n```cpp\nglcore::shader_program shaders_single(\"Basic\", \"shader_examples/basic.glsl\");\n\n// the name of the shader program will be set to 'basic'\nglcore::shader_program shader_single_noname(\"shader_examples/basic.glsl\");\n```\nFor the shader parser to differentiate between the different shaders in the file, the shader code needs to start with a specific command line - ```#type [shader type]```\n#### Example\n```glsl\n#type vertex\n#version 330 core\n\nlayout(location = 0) in vec3 a_Position;\n\nout vec3 v_Position;\n\nvoid main()\n{\n\tv_Position = a_Position;\n\tgl_Position = vec4(a_Position, 1.0);\n};\n\n#type fragment\n#version 330 core\n\nlayout(location = 0) out vec4 color;\n\nuniform vec4 u_Color;\n\nvoid main()\n{\n\tcolor = u_Color;\n};\n```\n### Multiple files\nWith this approach, you will need to spefify the type of the shader with an enum value, which resides in the ```glcore::shader_type``` namespace, and a file path.\n```cpp\nglcore::shader_program shaders(\"Basic\", {\n\t\t{ glcore::shader_type::vertex, \"shader_examples/vert.glsl\" },\n\t\t{ glcore::shader_type::fragment, \"shader_examples/frag.glsl\" }\n\t\t});\n```\n### Supported types of shaders\nShader Type | Enum Value | GLSL Command\n------------ | ------------- | -------------\nVertex | ```glcore::shader_type::vertex``` | ```#type vertex```\nFragment | ```glcore::shader_type::fragment``` | ```#type fragment```\nTessellation Control | ```glcore::shader_type::tess_control``` | ```#type tess_control```\nTessellation Evaluation | ```glcore::shader_type::tess_eval``` | ```#type tess_eval```\nGeometry | ```glcore::shader_type::geometry``` | ```#type geometry```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianpanov%2Fglcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristianpanov%2Fglcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianpanov%2Fglcore/lists"}