मैं लिनक्स लाल-टोपी पर जीएलएफडब्ल्यू का उपयोग कर ओपनजीएल पूर्ण स्क्रीन विंडो खोलने की कोशिश कर रहा हूं। मेरे पास एक डेस्कटॉप है जो 3840 * 1080 के कुल रिज़ॉल्यूशन के साथ दो मॉनीटर फैलाता है।एक पूर्णस्क्रीन ओपनजीएल विंडो खोलना
मुझे दो समस्याएं हैं: 1. विंडो को केवल एक मॉनीटर पर खोला गया है जिसमें 1920 की अधिकतम विंडो चौड़ाई (एकल मॉनिटर की चौड़ाई) है। 2. खिड़की की अधिकतम ऊंचाई 1003 है (जो मुझे लगता है कि टास्क बार की ऊंचाई और शीर्ष पट्टी की ऊंचाई से स्क्रीन की ऊंचाई है)।
if (glfwInit() == GL_FALSE)
std::cout<< "Unable to initialize GLFW\n";
glfwOpenWindowHint(GLFW_STEREO, GL_FALSE);
if (glfwOpenWindow(3840,1080,8,8,8,0,24,0,GLFW_FULLSCREEN) == GL_FALSE)
std::cout<< "Unable to open window\n";
int width, height;
glfwGetWindowSize(&width, &height);
std::cout << "width = " << width << " height = " << height << "\n";
उत्पादन: चौड़ाई = 1920 ऊंचाई = 1003
संपादित करें: मैं उपलब्ध स्क्रीन मोड की जाँच करने के xrandr का इस्तेमाल किया और मिल गया:
इस कोड मैं खिड़की खोलने के लिए उपयोग है
स्क्रीन 0: न्यूनतम 3840 x 1080, वर्तमान 3840 x 1080, अधिकतम 3840 x 1080 डिफ़ॉल्ट कनेक्ट 3840x1080 + 0 + 0 0 मिमी x 0 मिमी 3840x1080 50.0 *
,210EDIT2: मैं X11
int doubleBufferAttributes[] = {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True, /* Request a double-buffered color buffer with */
GLX_RED_SIZE, 1, /* the maximum number of bits per component */
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None
};
static Bool WaitForNotify(Display *dpy, XEvent *event, XPointer arg) {
return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
}
int main(int argc, char *argv[])
{
Display *dpy;
Window xWin;
XEvent event;
XVisualInfo *vInfo;
XSetWindowAttributes swa;
GLXFBConfig *fbConfigs;
GLXContext context;
GLXWindow glxWin;
int swaMask;
int numReturned;
int swapFlag = True;
/* Open a connection to the X server */
dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
printf("Unable to open a connection to the X server\n");
exit(EXIT_FAILURE);
}
/* Request a suitable framebuffer configuration - try for a double
** buffered configuration first */
fbConfigs = glXChooseFBConfig(dpy, DefaultScreen(dpy),
doubleBufferAttributes, &numReturned);
/* Create an X colormap and window with a visual matching the first
** returned framebuffer config */
vInfo = glXGetVisualFromFBConfig(dpy, fbConfigs[0]);
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vInfo->screen),
vInfo->visual, AllocNone);
swaMask = CWBorderPixel | CWColormap | CWEventMask;
xWin = XCreateWindow(dpy, RootWindow(dpy, vInfo->screen), 0, 0, 3840, 1080,
0, vInfo->depth, InputOutput, vInfo->visual,
swaMask, &swa);
XWindowAttributes attt;
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "he = " << attt.height << " wi = " << attt.width << "\n";
/* Create a GLX context for OpenGL rendering */
context = glXCreateNewContext(dpy, fbConfigs[0], GLX_RGBA_TYPE,
NULL, True);
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "2he = " << attt.height << " wi = " << attt.width << "\n";
/* Create a GLX window to associate the frame buffer configuration
** with the created X window */
glxWin = glXCreateWindow(dpy, fbConfigs[0], xWin, NULL);
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "3he = " << attt.height << " wi = " << attt.width << "\n";
/* Map the window to the screen, and wait for it to appear */
XMapWindow(dpy, xWin);
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "4he = " << attt.height << " wi = " << attt.width << "\n";
XIfEvent(dpy, &event, WaitForNotify, (XPointer) xWin);
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "5he = " << attt.height << " wi = " << attt.width << "\n";
/* Bind the GLX context to the Window */
glXMakeContextCurrent(dpy, glxWin, glxWin, context);
XGetWindowAttributes(dpy,xWin, &attt);
std::cout << "6he = " << attt.height << " wi = " << attt.width << "\n";
उत्पादन होता है का उपयोग कर विंडो खोलने के लिए मेरी कोड बदल गए हैं:
he = 1080 wi = 3840
2he = 1080 wi = 3840
3he = 1080 wi = 3840
4he = 1080 wi = 3840
5he = 1003 wi = 1920
6he = 1003 wi = 1920
ऐसा लगता है खिड़की है जब इसका आकार सिकुड़ता प्रदर्शित हो कि।
क्या आपने उपलब्ध वीडियो मोड की गणना करने और जांचने की जांच की है? –
मैं विंडो खोलने के लिए जीएलएफडब्ल्यू का उपयोग करता हूं, इसलिए नहीं। मैंने वीडियो मोड से पूछने के लिए 'xrandr' का उपयोग किया: स्क्रीन 0: न्यूनतम 3840 x 1080, वर्तमान 3840 x 1080, अधिकतम 3840 x 1080. मैं वर्तमान में एक्स का उपयोग कर विंडो खोलने के लिए कोड बदल रहा हूं। क्या आप मुझे इंगित कर सकते हैं एक ऐसे फ़ंक्शन के लिए जो उपलब्ध वीडियो मोड का आकलन करता है? डिफ़ॉल्ट कनेक्ट 3840x1080 + 0 + 0 0 मिमी x 0 मिमी 3840x1080 50.0 * –
@ निकोलबोलस कृपया प्रश्न का नवीनतम संपादन देखें। –