int temp;
int attrib[]={GLX_RGBA,GLX_DOUBLEBUFFER,GLX_RED_SIZE,4,GLX_GREEN_SIZE,4,GLX_BLUE_SIZE,4,GLX_DEPTH_SIZE,16,None};
// Setting up GLX
hDis=XOpenDisplay(NULL);
if (hDis==NULL)
{
CMsgBox("Unable to open display. Program will now close","Error");
return false;
}
if (!glXQueryExtension(hDis,&temp,&temp))
{
CMsgBox("X server does not have GLX extension support. Program will now close.","Error");
return false;
}
hScr=DefaultScreen(hDis);
hVi=glXChooseVisual(hDis,hScr,attrib);
if (hVi==NULL)
{
CMsgBox("Unable to setup visual data. Program will now close","Error");
return false;
}
hCx=glXCreateContext(hDis,hVi,0,true);
if (hCx==NULL)
{
CMsgBox("Unable create OpenGL context. Program will now close","Error");
return false;
}
cMap=XCreateColormap(hDis,RootWindow(hDis,hVi->screen),hVi->visual,AllocNone);
// Setting properties
maxwidth=DisplayWidth(hDis,hScr);
maxheight=DisplayHeight(hDis,hScr);
wAtt.colormap=cMap;
wAtt.border_pixel=0;
wAtt.event_mask=KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask|FocusChangeMask;
wAtt.override_redirect=true;
if (width==-1)
{
width=maxwidth;
height=maxheight;
}
Pixmap icon;
XWMHints*wHints=XAllocWMHints();
XClassHint*cHints=XAllocClassHint();
XSizeHints*sHints=XAllocSizeHints();
XTextProperty wName,cName;
XStringListToTextProperty(&wndtitle,1,&wName);
XStringListToTextProperty(&wndtitle,1,&cName);
wHints->initial_state=NormalState;
wHints->input=false;
wHints->icon_pixmap=icon;
wHints->flags=InputHint|StateHint|IconPixmapHint;
cHints->res_name=wndtitle;
cHints->res_class="Wnd";
sHints->flags=PPosition|PSize;
//hIcon=XInternAtom(hDis,"_NET_WM_ICON",false);
//cardinal=XInternAtom(hDis,"CARDINAL",false);
// Init keys
CKEY_A=XKeysymToKeycode(hDis,XK_a);
CKEY_B=XKeysymToKeycode(hDis,XK_b);
CKEY_C=XKeysymToKeycode(hDis,XK_c);
CKEY_D=XKeysymToKeycode(hDis,XK_d);
CKEY_E=XKeysymToKeycode(hDis,XK_e);
CKEY_F=XKeysymToKeycode(hDis,XK_f);
CKEY_G=XKeysymToKeycode(hDis,XK_g);
CKEY_H=XKeysymToKeycode(hDis,XK_h);
CKEY_I=XKeysymToKeycode(hDis,XK_i);
CKEY_J=XKeysymToKeycode(hDis,XK_j);
CKEY_K=XKeysymToKeycode(hDis,XK_k);
CKEY_L=XKeysymToKeycode(hDis,XK_l);
CKEY_M=XKeysymToKeycode(hDis,XK_m);
CKEY_N=XKeysymToKeycode(hDis,XK_n);
CKEY_O=XKeysymToKeycode(hDis,XK_o);
CKEY_P=XKeysymToKeycode(hDis,XK_p);
CKEY_Q=XKeysymToKeycode(hDis,XK_q);
CKEY_R=XKeysymToKeycode(hDis,XK_r);
CKEY_S=XKeysymToKeycode(hDis,XK_s);
CKEY_T=XKeysymToKeycode(hDis,XK_t);
CKEY_U=XKeysymToKeycode(hDis,XK_u);
CKEY_V=XKeysymToKeycode(hDis,XK_v);
CKEY_W=XKeysymToKeycode(hDis,XK_w);
CKEY_X=XKeysymToKeycode(hDis,XK_x);
CKEY_Y=XKeysymToKeycode(hDis,XK_y);
CKEY_Z=XKeysymToKeycode(hDis,XK_z);
CKEY_0=XKeysymToKeycode(hDis,XK_0);
CKEY_1=XKeysymToKeycode(hDis,XK_1);
CKEY_2=XKeysymToKeycode(hDis,XK_2);
CKEY_3=XKeysymToKeycode(hDis,XK_3);
CKEY_4=XKeysymToKeycode(hDis,XK_4);
CKEY_5=XKeysymToKeycode(hDis,XK_5);
CKEY_6=XKeysymToKeycode(hDis,XK_6);
CKEY_7=XKeysymToKeycode(hDis,XK_7);
CKEY_8=XKeysymToKeycode(hDis,XK_8);
CKEY_9=XKeysymToKeycode(hDis,XK_9);
CKEY_SPACE=XKeysymToKeycode(hDis,XK_space);
CKEY_BACKSPACE=XKeysymToKeycode(hDis,XK_space);
CKEY_TAB=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_ENTER=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RIGHT=XKeysymToKeycode(hDis,XK_Right);
CKEY_LEFT=XKeysymToKeycode(hDis,XK_Left);
CKEY_DOWN=XKeysymToKeycode(hDis,XK_Down);
CKEY_UP=XKeysymToKeycode(hDis,XK_Up);
CKEY_SEMICOLON=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_DIVIDE=XKeysymToKeycode(hDis,XK_slash);
CKEY_TILDE=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RBRACKET=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LBRACKET=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_SEPERATOR=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_QUOTE=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_MINUS=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_PLUS=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_PERIOD=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_COMMA=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RSHIFT=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LSHIFT=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RCTRL=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LCTRL=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_ESC=XKeysymToKeycode(hDis,XK_Escape);
CKEY_F1=XKeysymToKeycode(hDis,XK_semicolon);
// Final window
hWin=XCreateWindow(hDis,RootWindow(hDis,hVi->screen),xpos,ypos,width,height,0,hVi->depth,InputOutput,hVi->visual,
CWBorderPixel|CWColormap|CWEventMask|CWOverrideRedirect,&wAtt);
icon=XCreateBitmapFromData(hDis,hWin,icon_bitmap_bits,icon_bitmap_width,icon_bitmap_height);
XSetWMProperties(hDis,hWin,&wName,&cName,NULL,0,sHints,wHints,cHints);
//XChangeProperty(hDis,hWin,hIcon,cardinal,32,PropModeReplace,(const unsigned char*)buffer,length);
glXMakeCurrent(hDis,hWin,hCx);
XMapRaised(hDis,hWin);
XSetInputFocus(hDis,hWin,RevertToNone,CurrentTime);
return true;
the code cant compile here, but it does at mine, no compiler errors. This is the code creating the window glx.
Sorry for the bad format, im still working on it...