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

glewCreateContext fails on MacOSX on Travis #34

Open
wchristian opened this issue Feb 13, 2017 · 16 comments
Open

glewCreateContext fails on MacOSX on Travis #34

wchristian opened this issue Feb 13, 2017 · 16 comments

Comments

@wchristian
Copy link
Collaborator

Right now the tests only skip and mention they failed. They don't try to inspect the return values to see why they failed. Tests should try and give more feedback about that.

@wchristian
Copy link
Collaborator Author

GLenum err = glewInit();
if (GLEW_OK != err)
{
  /* Problem: glewInit failed, something is seriously wrong. */
  fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
  ...
}

@wchristian
Copy link
Collaborator Author

This is also misleading:

skip "glewInit not successful, skipping tests", 2 if glewCreateContext() or glewInit(); # GLEW_OK == 0

Should be separate lines. Also i'm curious to see if glewInit gives useful feedback if it's called before glewCreateContext. Maybe try this in a separate branch.

@wchristian
Copy link
Collaborator Author

Where did the idea to use glewCreateContext come from anyhow? As far as i can see it is only declared for glewinfo, which is a specific commandline tool.

@devel-chm
Copy link
Collaborator

The line-by-line check for the glewCreateContext and glewInit are in test 01_context.t
The usage in 02_* etc is for skipping runtime tests if real contexts are not available.
I think Max used this approach first but it is is good in the sense of being lightweight.

@wchristian
Copy link
Collaborator Author

Alright, so neither of us knows why it's there. Checking to see if it's actually necessary.

As for 02, the line is misleading as it only says glewInit in the skip message, it should at least mention both, i think?

@wchristian
Copy link
Collaborator Author

Err, results on this:

If i don't run glewCreateContext (using master) it crashes as soon as it tries to use a GL function:

glGenBuffers not available on this machine at C:/strawberry/perl/site/lib/OpenGL/Modern/Helpers.pm line 267.

If i don't run glewInit, Microidium works, but runs at 3.6 fps?

@wchristian
Copy link
Collaborator Author

Ok, on further inspection, without create context glewinit errors out with "Missing GL version" if glCreateContext wasn't called.

Do you think you can get some more details out of glCreateContext if it fails? Maybe by making some of the internally called functions available in Perl? ( https://github.com/nigels-com/glew/blob/master/auto/src/glewinfo_tail.c#L176-L598 )

@devel-chm
Copy link
Collaborator

I thought you were asking about why glewCreateContext specifically. In order for GLEW to load the needed extensions, there has to be an OpenGL context. glewCreateContext is good because it comes with the GLEW distribution.

@wchristian
Copy link
Collaborator Author

Alright, so if that's not strictly necessary, can you throw together a different context creation process we can bash against mac?

@wchristian wchristian changed the title glewCreateContext and glewInit fail on MacOSX glewCreateContext fails on MacOSX on Travis Feb 13, 2017
@devel-chm
Copy link
Collaborator

You can use GLUT from OpenGL. Once the window+context is created, you can call glewInit. If you use the just fixed for the transparent glewInit calls, it should just work. (Famous last words...)

@wchristian
Copy link
Collaborator Author

Right, so you probably want to add -framework GLUT to MFpl so it can link and then special-case macosx in the test. Also, i'm asking you to write the test code because you know better what you're doing there. :x

@devel-chm
Copy link
Collaborator

devel-chm commented Feb 13, 2017 via email

@devel-chm
Copy link
Collaborator

Oh, I didn't realize this was in the Travis-CI thread. There is definitely something needed to allow glutCreateContext to work. I vaguely recall something about Xvfb or some such from a search... HTH.

@wchristian
Copy link
Collaborator Author

If i understand this correctly, xvfb won't run on osx anymore without considerable effort to get quartz installed and set up:

http://stackoverflow.com/questions/25451133/xvfb-run-on-os-x/32786365#32786365

Please read and tell me what you get from it.

@wchristian
Copy link
Collaborator Author

Ok, turns out there is xvfb on those machines:

travis-ci/travis-ci#2351 (comment)

And i actually got somewhat close to making things happen, but now i'm quite stuck:

$ if [ "${TRAVIS_OS_NAME}" = "osx" ]; then Xvfb :99 -ac -screen 0 1024x768x8 -extension GLX; fi
[mi] Extension "GLX" is not recognized
[mi] Only the following extensions can be run-time disabled:
[mi]    Generic Events
[mi]    Composite
[mi]    DAMAGE
[mi]    DOUBLE-BUFFER
[mi]    DPMS
[mi]    MIT-SCREEN-SAVER
[mi]    MIT-SHM
[mi]    RANDR
[mi]    RENDER
[mi]    X-Resource
[mi]    XFIXES
[mi]    XINERAMA
[mi]    XTEST
[mi]    XVideo
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
The command "if [ "${TRAVIS_OS_NAME}" = "osx" ]; then Xvfb :99 -ac -screen 0 1024x768x8 -extension GLX; fi" failed and exited with 1 during .

@wchristian
Copy link
Collaborator Author

Asked in the Travis issues: travis-ci/travis-ci#7313

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

2 participants