Open lugui2009 opened 6 years ago
There were some EGL fixes for GLEW 2.1.0. Could you give that a try?
@nigels-com I have also tried 2.1.0. However I got the same error.
Did you have any luck running glewinfo on that GPU/driver?
This is what I get on an Intel GPU:
$ LD_LIBRARY_PATH=`pwd`/lib DISPLAY=:0 bin/glewinfo
---------------------------
GLEW Extension Info
---------------------------
GLEW version 2.1.0
Running on a Mesa DRI Intel(R) Iris Pro Graphics 580 (Skylake GT4e) from Intel Open Source Technology Center
OpenGL version 3.0 Mesa 17.0.7 is supported
GL_VERSION_1_1: OK
---------------
GL_VERSION_1_2: OK
---------------
glCopyTexSubImage3D: OK
glDrawRangeElements: OK
glTexImage3D: OK
glTexSubImage3D: OK
...
For the attached test code, I get a context creation failure. I tried xfce and Gnome on Ubuntu 17.10
The major vesion is 1
The minor vesion is 4
Unable to create EGL context (eglError: 12297)
The test program worked for me with a small change to request OpenGL 2.1:
EGL_CONTEXT_MAJOR_VERSION, 2,
EGL_CONTEXT_MINOR_VERSION, 1,
Hello everybody:
I have an issue that I want use EGL to create context for desktop OpenGL .But I get segfault when executing my demo code. My graphic card is intel integrated card ,and my os is ubuntn.For more details about my pc ,take a look at image bellow.![os](https://user-images.githubusercontent.com/20158014/33052920-1637d8e8-ceac-11e7-837e-cc7c5c0c9aa0.jpg)
I downloaded glew2.0.0 source code ,because I saw "OSMesa and EGL support". However, I encountered some warnings and an error (maybe not fatal error) when building . Following codes were used(I followed the README):![build](https://user-images.githubusercontent.com/20158014/33053175-3400baf6-cead-11e7-9cff-fe9292527141.jpg)
when executing "make SYSTEM=linux-egl" there were some warnings as follows,I were not so sure these warnings are fatal or not;![first](https://user-images.githubusercontent.com/20158014/33053292-ba6726e8-cead-11e7-90e0-ec33e094ff26.jpg)
when executing "sudo make install" It seemed to be OK![second](https://user-images.githubusercontent.com/20158014/33053380-363745d2-ceae-11e7-862b-03a866bab0fe.jpg)
when executing "make clean" I came out an error,I don't know why. I am an Admin user.![third](https://user-images.githubusercontent.com/20158014/33053545-14e3ac76-ceaf-11e7-9e6e-294d6fdfb7b1.jpg)
I were not sure that whether I builded the glew2.0 successfully or not successfully when using "SYSTEM=linux-egl",so someone can give me some help at this point.
And then I tested my code(I think maybe the build was successful) ,my test code as follows . I used X11+EGL+glew+desktop OpenGL.
include <X11/Xlib.h>
include <X11/Xatom.h>
include <X11/Xutil.h>
include <EGL/egl.h>
include <EGL/eglext.h>
include <GL/glew.h>
include <GL/gl.h>
Display *x_display; Window win;
EGLDisplay egl_display; EGLContext egl_context; EGLSurface egl_surface;
int main(int argc, char *argv[]) {
XWMHints hints; hints.input = True; hints.flags = InputHint; XSetWMHints(x_display, win, &hints); XMapWindow ( x_display , win ); // make the window visible on the screen XStoreName ( x_display , win , "GL test" ); Atom wm_state = XInternAtom ( x_display, "_NET_WM_STATE", False ); Atom fullscreen = XInternAtom ( x_display, "_NET_WM_STATE_FULLSCREEN", False );
XEvent xev; memset ( &xev, 0, sizeof(xev) );
xev.type = ClientMessage; xev.xclient.window = win; xev.xclient.message_type = wm_state; xev.xclient.format = 32; xev.xclient.data.l[0] = 1; xev.xclient.data.l[1] = fullscreen; XSendEvent ( // send an event mask to the X-server x_display, DefaultRootWindow ( x_display ), False, SubstructureNotifyMask, &xev );
//SET UP EGL
if ( egl_display == EGL_NO_DISPLAY ) { std::cerr << "Got no EGL display." << std::endl; return 1; }
EGLint major, minor; if ( !eglInitialize( egl_display, &major, &minor ) ) { std::cerr << "Unable to initialize EGL" << std::endl; return 1; }
std::cout<<"The major vesion is "<<major<<std::endl; std::cout<<"The minor vesion is "<<minor<<std::endl;
EGLint attr[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE };
EGLConfig ecfg; EGLint num_config; if ( !eglChooseConfig( egl_display, attr, &ecfg, 1, &num_config ) ) { std::cerr << "Failed to choose config (eglError: " << eglGetError() << ")" << std ::endl; return 1; }
if ( num_config != 1 ) { std::cerr << "Didn't get exactly one config, but " << num_config << std::endl; return 1; } if(!eglBindAPI (EGL_OPENGL_API)) { std::cerr<<"Bind EGL_OPENGL_API failed ,crying!"<<std::endl; return 1; } egl_surface = eglCreateWindowSurface ( egl_display, ecfg, win, NULL ); if ( egl_surface == EGL_NO_SURFACE ) { std::cerr << "Unable to create EGL surface (eglError: " << eglGetError() << ")" << std::endl; return 1; }
EGLint ctxattr[] = { EGL_CONTEXT_MAJOR_VERSION, 4, EGL_CONTEXT_MINOR_VERSION, 5, EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR, EGL_NONE };
egl_context = eglCreateContext ( egl_display, ecfg, EGL_NO_CONTEXT, ctxattr ); if ( egl_context == EGL_NO_CONTEXT ) { std::cerr << "Unable to create EGL context (eglError: " << eglGetError() << ")" << std::endl; return 1; }
eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context );
std::cout<<"I am above glew!!"<<std::endl; glewExperimental = GL_TRUE; std::cout<<glGetError()<<std::endl; std::cout<<"I am between glewExperimental and glewInit()"<<std::endl; glewInit(); std::cout<<glGetError()<<std::endl; std::cout<<"I am below glew!!"<<std::endl; std::cout<<"The OpenGL version is :"<<glGetString(GL_VERSION)<<std::endl;
bool quit=false; while(!quit) { while(XPending(x_display)) { XEvent xev; XNextEvent(x_display,&xev); if(xev.type == KeyPress) { quit = true; } }
}
eglDestroyContext ( egl_display, egl_context ); eglDestroySurface ( egl_display, egl_surface ); eglTerminate ( egl_display ); XDestroyWindow ( x_display, win ); XCloseDisplay ( x_display );
}
build g++ X11eglGLewSimple.cpp -o X11eglGLewSimple.out -lGLEW -lGL -lX11 -lEGL
But I got the segment bellows when entering glewInit(),I don't know how to deal with it .![sg](https://user-images.githubusercontent.com/20158014/33053890-0621b41a-ceb1-11e7-9287-e42511c57086.jpg)
I found a strange thingthat my code could be executed successfully when I used Nvidia even though I used glew 1.13. But I encountered segment fault when using integrated card.Can someone help me?give me some tips or documents or something else ,or should I give more information.thank you very much.