mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
fix pixi run examples for linux
This commit is contained in:
@@ -120,9 +120,14 @@ int main()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "GLFW Version: " << glfwGetVersionString() << "\n";
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
// Force GLX context creation API to ensure compatibility with GLEW
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
#endif
|
#endif
|
||||||
@@ -141,16 +146,31 @@ int main()
|
|||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||||
|
|
||||||
|
// Check if context is valid using standard GL
|
||||||
|
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||||
|
const GLubyte* version = glGetString(GL_VERSION);
|
||||||
|
if (renderer && version) {
|
||||||
|
std::cout << "Renderer: " << renderer << "\n";
|
||||||
|
std::cout << "OpenGL version supported: " << version << "\n";
|
||||||
|
} else {
|
||||||
|
std::cerr << "Failed to get GL_RENDERER or GL_VERSION. Context might be invalid.\n";
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- GLEW init ----------
|
// ---------- GLEW init ----------
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
GLenum glewErr = glewInit();
|
GLenum glewErr = glewInit();
|
||||||
if (glewErr != GLEW_OK)
|
if (glewErr != GLEW_OK)
|
||||||
{
|
{
|
||||||
|
// Ignore NO_GLX_DISPLAY if we have a valid context
|
||||||
|
if (glewErr == GLEW_ERROR_NO_GLX_DISPLAY && renderer) {
|
||||||
|
std::cerr << "GLEW warning: " << glewGetErrorString(glewErr) << " (Ignored because context seems valid)\n";
|
||||||
|
} else {
|
||||||
std::cerr << "Failed to initialize GLEW: " << reinterpret_cast<const char*>(glewGetErrorString(glewErr))
|
std::cerr << "Failed to initialize GLEW: " << reinterpret_cast<const char*>(glewGetErrorString(glewErr))
|
||||||
<< "\n";
|
<< "\n";
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- GL state ----------
|
// ---------- GL state ----------
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ ninja = ">=1.13.2,<2"
|
|||||||
|
|
||||||
[target.linux-64.dependencies]
|
[target.linux-64.dependencies]
|
||||||
mesa-libgl-devel-cos7-x86_64 = ">=18.3.4,<19"
|
mesa-libgl-devel-cos7-x86_64 = ">=18.3.4,<19"
|
||||||
|
xorg-x11-server-xvfb-cos7-x86_64 = ">=1.20.4,<2"
|
||||||
|
|
||||||
|
[target.linux-64.activation.env]
|
||||||
|
__GLX_VENDOR_LIBRARY_NAME = "mesa"
|
||||||
|
EGL_PLATFORM = "x11"
|
||||||
|
GLFW_PLATFORM = "x11"
|
||||||
|
|
||||||
|
[target.linux-64.tasks]
|
||||||
|
examples = { cwd = "pixi", cmd = "xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX +render' cmake -DCMAKE_BUILD_TYPE=Debug -P run.examples.cmake", depends-on = ["build"] }
|
||||||
|
|
||||||
[target.win-64.dependencies]
|
[target.win-64.dependencies]
|
||||||
mesa-libgl-devel-cos7-x86_64 = ">=18.3.4,<19"
|
mesa-libgl-devel-cos7-x86_64 = ">=18.3.4,<19"
|
||||||
|
|||||||
Reference in New Issue
Block a user