Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#116 closed defect (fixed)

Linux daily build gets 3.0 compatibility context instead of 3.3 core OpenGL context

Reported by: Tom Goddard Owned by: Greg Couch
Priority: major Milestone:
Component: Graphics Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: chimera

Description

Chimera 2 fails to start on an Ubuntu 15.04 system with Intel HD 6000 graphics because it gets an OpenGL 3.0 compatibility context when Chimera requires 3.3. Using environment variable MESA_GL_VERSION_OVERRIDE=3.3 causes Chimera 2 to start with a 3.3 core context and renders correctly. Chimera 2 should ask for a core context since it only requires a core context.

glxinfo on this Ubuntu 15.04 system (my home computer) lists OpenGL 3.0 compatibility context and OpenGL 3.3 core context. A compatibility context requires more support (legacy fixed function routines) which is no doubt why the compatibility context is only 3.0.

Change History (5)

comment:1 by Tom Goddard, 10 years ago

I extended our wx opengl profile patch which allowed asking for a core profile on Mac to also request a core profile on Linux.
Not yet tested.

comment:2 by Tom Goddard, 10 years ago

Patching wx to ask for an OpenGL 3.3 core profile on Linux proved more troublesome than expected. It requires using a GLX extension to request a core profile, ARB_create_context_profile, that provides a new call

glXCreateContextAttribsARB()

to be used instead of the standard GLX call used by wx glXCreateNewContext(). The wx code that creates the context does not get passed the requested attributes (e.g. core profile, version 3.3) so modifications to wx that change the arguments of the wx functions would be needed. This is too much trouble (especially if we replace wx with qt) given that a much easier solution in Python exists.

I did try the above GLX extension and it worked. Here is my test code in wxGLContext() in

wxPython_Phoenix-3.0.3.dev1719+62a2221/ext/wxWidgets/src/unix/glx11.cpp

I replaced

m_glContext = glXCreateNewContext( wxGetX11Display(), fbc[0], GLX_RGBA_TYPE,

other ? other->m_glContext : None,
GL_TRUE );

with

int attrib_list[] = {GLX_CONTEXT_PROFILE_MASK_ARB,

GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_MAJOR_VERSION_ARB,
3,
GLX_CONTEXT_MINOR_VERSION_ARB,
3,
0};

PFNGLXCREATECONTEXTATTRIBSARBPROC f = (PFNGLXCREATECONTEXTATTRIBSARBPROC) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
m_glContext = f( wxGetX11Display(), fbc[0],

(other ? other->m_glContext : None), GL_TRUE,
attrib_list );

std::cerr << "used glxcreatecontextattribsarb\n";

Here I hard-coded the core profile 3.3 request.

The simpler Python solution is to set the environment variable MESA_GL_VERSION_OVERRIDE=3.3 before wx or pyopengl are imported. It doesn't matter if it gives a core or compatibility profile as long as we have OpenGL 3.3. Current mesa offers only 3.0 with a compatibility profile but that may change.

I've implemented the Python solution in the Chimera2 startup script Chimera2_main.py.

comment:3 by Greg Couch, 10 years ago

Owner: changed from Conrad Huang to Greg Couch
Status: newassigned

comment:4 by Greg Couch, 10 years ago

Resolution: fixed
Status: assignedclosed

Fixed in 92cd7d22cbb4d4bedc8059a95eb3c6ec3d541863. Backported OpenGL core profile support from wx master branch.

comment:5 by goddard@…, 10 years ago

Thanks!  This should allow removing the MESA_GL_VERSION_OVERRIDE hack in Chimera2_main.py by adjusting the main and sideview context creation Python code to request a core 3.3 profile on all platforms (currently only requested for Mac).


Note: See TracTickets for help on using tickets.