-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
70 lines (55 loc) · 1.94 KB
/
main.cpp
File metadata and controls
70 lines (55 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#define GLX_GLXEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <vector>
#include <iostream>
#include <cstring>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>
int main(int argc, char** argv) {
std::vector<std::string> displayStrings;
displayStrings.push_back(":0.0");
displayStrings.push_back(":0.0");
for(size_t i = 0; i < displayStrings.size(); ++i) {
std::string displayString = displayStrings[i];
Display* display = XOpenDisplay( displayString.c_str() );
int screenNumber = DefaultScreen( display );
int glx_fb_configs_N;
int fb_attrib[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None,
None
};
GLXFBConfig* glx_fb_configs = glXChooseFBConfig( display,
screenNumber,
fb_attrib,
&glx_fb_configs_N );
int screen_number = DefaultScreen( display );
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB_f = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddressARB((GLubyte *) "glXCreateContextAttribsARB");
std::vector<int> attribs;
attribs.push_back( None );
// Try direct and not direct
bool m_create_context_error = false;
std::cerr << "Before create context" << std::endl;
std::cerr << "Display is " << displayString << std::endl;
std::cerr << "glXCreateContextAttribsARB_f = " << (void*)glXCreateContextAttribsARB_f << std::endl;
std::cerr << "Scren Number is " << screenNumber << std::endl;
GLXContext context = glXCreateContextAttribsARB_f( display,
glx_fb_configs[0],
NULL,
GL_TRUE,
NULL );
std::cout << "After" << std::endl;
XFree(glx_fb_configs);
glXDestroyContext(display, context);
XCloseDisplay(display);
}
}