Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OSX specific window hints #36

Closed
ghost opened this issue Jan 16, 2017 · 4 comments
Closed

Remove OSX specific window hints #36

ghost opened this issue Jan 16, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 16, 2017

This is the traceback I get:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "./__main__.py", line 7, in <module>
    main()
  File "./kitty/main.py", line 164, in main
    run_app(opts, args)
  File "./kitty/main.py", line 105, in run_app
    glewInit()
RuntimeError: OpenGL is missing the required ARB_texture_storage extension
[glfw error]  The GLFW library is not initialized

The test program demonstrates the issue.

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <stdio.h>

int main() {
  if (!glfwInit()) {
    fprintf(stderr, "error init");
    return 1;
  }

  /* These are the offending lines */
  glfw_window_hint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSION[0])
  glfw_window_hint(GLFW_CONTEXT_VERSION_MINOR, GL_VERSION[1])
  glfw_window_hint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE)
  glfw_window_hint(GLFW_OPENGL_FORWARD_COMPAT, True)

  GLFWwindow* window = glfwCreateWindow(640, 480, "Example", NULL, NULL);
  if (!window) {
    fprintf(stderr, "error window");
    glfwTerminate();
    return 1;
  }
  glfwMakeContextCurrent(window);

  glewInit();

  printf("%d", GLEW_ARB_texture_storage);

  glfwTerminate();
  return 0;
}

If you leave the offending lines in, the program outputs 0. Otherwise it outputs 1.

Recommend change:

glfw_window_hint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSION[0])

if isosx:
    glfw_window_hint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSION[0])
    glfw_window_hint(GLFW_CONTEXT_VERSION_MINOR, GL_VERSION[1])
    glfw_window_hint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE)
    glfw_window_hint(GLFW_OPENGL_FORWARD_COMPAT, True)
    glfw_window_hint(GLFW_SAMPLES, 0)
    # OS X cannot handle 16bit stencil buffers
    glfw_window_hint(GLFW_STENCIL_BITS, 8)
@ghost ghost mentioned this issue Jan 16, 2017
@kovidgoyal
Copy link
Owner

Those are not OS X specific. The ARB_texture_storage extension is required for TexStorage3D(), which kitty uses. And OpenGL 3.3 Core Profile is required for the shader language kitty uses. If you remove those tests, you instead get cryptic, hard to debug failures instead.

@ghost
Copy link
Author

ghost commented Jan 17, 2017

Those are not OS X specific.

I think the test program I gave is pretty clear evidence that enabling them does not allow GLEW to detect the extension correctly on a non-OSX system.

The ARB_texture_storage extension is required for TexStorage3D(), which kitty uses.

See above.

And OpenGL 3.3 Core Profile is required for the shader language kitty uses. If you remove those tests, you instead get cryptic, hard to debug failures instead.

Not everybody uses Intel.

@kovidgoyal
Copy link
Owner

I dont see how it is clear evidence of anything other than that glew < 2 does not work. And OpenGL 3.3 is available with the Nvidia drivers, open source radeon drivers, open source intel drivers. I have no idea about AMD's propritary drivers, but I would be shocked if they did not support OpenGL 3.3 which is more than five years old.

@kovidgoyal
Copy link
Owner

To be precise, OpenGL 3.3 is seven years old: https://www.khronos.org/opengl/wiki/History_of_OpenGL#OpenGL_3.3_.282010.29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant