Hi Harmut,
I have refactored the X11/EGL setup so that it's now consistent to how
GLX is setup from the Traits input values. The relevant EGL block now
looks the below code segment. I've tested it against the EGL/GLES1
driver available with Kubuntu 11.04. I've incorported your change in
location of the eglBindAPI and the double EGL_NONE at the end of the
config attribute list.
This change should take you a little further towards what will work
with your system, and fill out some missing functionality under EGL.
Changes now checked into svn/trunk and OSG-3.0. If you do plan some
further changes please use this new GraphicsWindowX11.cpp as your
base.
Cheers,
Robert.
#ifdef OSG_USE_EGL
_valid = _ownsWindow ? createWindow() : setWindow(windowHandle);
if (!_valid)
{
XCloseDisplay( _display );
_display = 0;
return;
}
OSG_NOTICE<<"GraphicsWindowX11::init() - window created
="<<_valid<<std::endl;
eglBindAPI(EGL_OPENGL_ES_API);
EGLConfig eglConfig = 0;
#if defined(OSG_GLES2_AVAILABLE)
#define OSG_EGL_OPENGL_TARGET_BIT EGL_OPENGL_ES2_BIT
#else
#define OSG_EGL_OPENGL_TARGET_BIT EGL_OPENGL_ES_BIT
#endif
typedef std::vector<EGLint> Attributes;
Attributes attributes;
attributes.push_back(EGL_RED_SIZE); attributes.push_back(_traits->red);
attributes.push_back(EGL_GREEN_SIZE);
attributes.push_back(_traits->green);
attributes.push_back(EGL_BLUE_SIZE);
attributes.push_back(_traits->blue);
attributes.push_back(EGL_DEPTH_SIZE);
attributes.push_back(_traits->depth);
if (_traits->alpha) { attributes.push_back(EGL_ALPHA_SIZE);
attributes.push_back(_traits->alpha); }
if (_traits->stencil) {
attributes.push_back(EGL_STENCIL_SIZE);
attributes.push_back(_traits->stencil); }
if (_traits->sampleBuffers) {
attributes.push_back(EGL_SAMPLE_BUFFERS);
attributes.push_back(_traits->sampleBuffers); }
if (_traits->samples) { attributes.push_back(EGL_SAMPLES);
attributes.push_back(_traits->samples); }
attributes.push_back(EGL_RENDERABLE_TYPE);
attributes.push_back(OSG_EGL_OPENGL_TARGET_BIT);
attributes.push_back(EGL_NONE);
attributes.push_back(EGL_NONE);
int numConfigs;
if (!eglChooseConfig(_eglDisplay, &(attributes.front()),
&eglConfig, 1, &numConfigs) || (numConfigs != 1))
{
OSG_NOTICE<<"GraphicsWindowX11::init() - eglChooseConfig()
failed."<<std::endl;
XCloseDisplay( _display );
_valid = false;
_display = 0;
return;
}
_eglSurface = eglCreateWindowSurface(_eglDisplay, eglConfig,
(EGLNativeWindowType)_window, NULL);
if (_eglSurface == EGL_NO_SURFACE)
{
OSG_NOTICE<<"GraphicsWindowX11::init() -
eglCreateWindowSurface(..) failed."<<std::endl;
XCloseDisplay( _display );
_valid = false;
_display = 0;
return;
}
#if defined(OSG_GLES1_AVAILABLE)
EGLint* contextAttribs = 0;
#else
EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION,
2,
EGL_NONE
};
#endif
_context = eglCreateContext(_eglDisplay, eglConfig,
sharedContext, contextAttribs);
if (_context == EGL_NO_CONTEXT)
{
OSG_NOTICE<<"GraphicsWindowX11::init() -
eglCreateContext(..) failed."<<std::endl;
XCloseDisplay( _display );
_valid = false;
_display = 0;
return;
}
_initialized = true;
checkEGLError("after eglCreateContext()");
#else
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org