Comments (6)
Mh that should work, can you debug into glad_gl_find_core_gl
either via a debugger or just add a few printf
's, I am mainly interested in the version
string before the GLAD_IMPL_UTIL_SSCANF
call and the major
, minor
variables after.
from glad.
What does glGetString(GL_VERSION)
return?
from glad.
Hello Dav1dde, thank you for responding so quickly.
glGetString(GL_VERSION)
returns "4.6.0 Core Profile Context 24.1.1.231127"
, I think as expected.
from glad.
Thank you for the advice. I was able to find the source of the problem. As it turns out, glad_gl_find_core_gl
and GLAD_IMPL_UTIL_SSCANF
are not called at any point.
It seems that GLAD_GL_IMPLEMENTATION
must be defined before gl.h
is included in order to be called, so I assume the version is not set otherwise. After adding #define GLAD_GL_IMPLEMENTATION
before #include <glad/gl.h>
, the version is properly set:
Should I fork and PR the example with the definition of GLAD_GL_IMPLEMENTATION
?
Revised source file:
#include <stdlib.h>
#include <stdio.h>
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
#include <GLFW/glfw3.h>
const GLuint WIDTH = 800, HEIGHT = 600;
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) {
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void) {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); // GL version edited for version test
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "[glad] GL with GLFW", NULL, NULL);
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, key_callback);
int version = gladLoadGL(glfwGetProcAddress);
printf("GL %d.%d\n", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
glClearColor(0.7f, 0.9f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
glfwTerminate();
return 0;
}
from glad.
Issue possibly resolved by fork in PR #464. Please let me know if there are any issues.
Thank you @Dav1dde
from glad.
As discussed in #464 (comment) we cannot re-produce the issue, closing it until reproducible.
from glad.
Related Issues (20)
- Glad.h missing HOT 1
- RFE: please start making github releases HOT 3
- GL_MAX_TEXTURE_COORDS missing HOT 2
- How to use Glad2? (gladLoadGL completely missing) HOT 6
- CMake glad_add_library(): REPRODUCIBLE keyword HOT 2
- Parsing extensions fails with Mesa and GLES2
- glad2 debug build recompiles every launch
- Surface related vk calls fail with an SDL-created Vulkan Surface (Vulkan 1.3)
- Provide cmake-package HOT 8
- [question] What heppened with the CMakeLists.txt file in the repository root? HOT 3
- glad_egl_find_core querying EGL_VERSION ahead of eglInitialize HOT 2
- <KHR/khrplatform.h> not found on OpenBSD, alpinelinux and others? HOT 14
- warning: 'GLAD_GLES2_USE_SYSTEM_EGL' is not defined, evaluates to 0 [-Wundef]
- Fail to use GL_NV_geometry_shader_passthrough bug. HOT 4
- Vulkan tests fail on 32bit x86 systems HOT 3
- GCC -fanalyzer report error when compiling glad HOT 15
- How to know why exactly GLAD failed.(ERROR DESCRIPTION) HOT 1
- Provide a way to automatically obtain the code without the need to manually download it from a web page. HOT 1
- Incrroect encoding when python read file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glad.