Z tego co czytałem na kilku forach to Intel leci sobie w kulki w mimo obsługi OGL 3.x w version string nadal wstawia 2.1.
Mógłby ktoś z Intelem na pokładzie skompilować taki kod?
#include <GL/glx.h>
#include <GL/gl.h>
#include <unistd.h>
#include <iostream>
#include <X11/Xlib.h>
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
int main (int argc, char ** argv){
Display *dpy = XOpenDisplay(0);
int nelements;
GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0, &nelements);
//kontekst z jednym bitem RGB, bez buforu glebii i AA
//static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };
//kontekst z 8b RGB + 24 D + 4xAA
int attrList[] =
{
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, GL_TRUE,
GLX_SAMPLES_ARB, 4,
None
};
XVisualInfo *vi = glXChooseVisual(dpy, DefaultScreen(dpy),attrList);
XSetWindowAttributes swa;
swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 100, 100, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel|CWColormap|CWEventMask, &swa);
XMapWindow (dpy, win);
//oldstyle context:
// GLXContext ctx = glXCreateContext(dpy, vi, 0, GL_TRUE);
std::cout << "glXCreateContextAttribsARB " << (void*) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB") << std::endl;
GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
int attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
0};
GLXContext ctx = glXCreateContextAttribsARB(dpy, *fbc, 0, true, attribs);
glXMakeCurrent (dpy, win, ctx);
glClearColor (0, 0.5, 1, 1);
glClear (GL_COLOR_BUFFER_BIT);
glXSwapBuffers (dpy, win);
sleep(1);
glClearColor (1, 0.5, 0, 1);
glClear (GL_COLOR_BUFFER_BIT);
glXSwapBuffers (dpy, win);
sleep(1);
ctx = glXGetCurrentContext();
glXDestroyContext(dpy, ctx);
}
Kompilacja: kod zapisujemy jako example.cpp i w konsoli walimy:
# g++ example.cpp -o example -lGL -lX11
# ./example
i wstawić to co wywali konsola. Będzie to albo błąd kompilacji (undefined reference) albo glXCreateContextAttribsARB i jego adres w pamięci.
Pozdrawiam