90 if(a_request->core.width<=0) a_this->core.width = 100;
91 if(a_request->core.height<=0) a_this->core.height = 100;
93 #ifdef OPENGLAREA_DEBUG
94 ::printf (
"debug : OpenGLArea : InitializeWidget : %s\n",::XtName(a_this));
97 OpenGLAreaPart& athis =
_athis(a_this);
98 athis.visual = CopyFromParent;
99 athis.installColormap = False;
100 athis.glContext = NULL;
106 display = XtDisplay(a_this);
107 screen = XtScreen(a_this);
108 iscreen = XScreenNumberOfScreen(screen);
111 if(::glXQueryExtension(display,&error,&event)==0) {
112 CWarn (
"X server does not have OpenGL extensions.\n");
115 if(athis.doubleBufferOn==True) {
126 vinfo = ::glXChooseVisual (display,iscreen,atbs_1);
137 vinfo = ::glXChooseVisual (display,iscreen,atbs_2);
149 vinfo = ::glXChooseVisual (display,iscreen,atbs_1);
159 vinfo = ::glXChooseVisual (display,iscreen,atbs_2);
164 CWarn (
"Can't choose a visual.\n");
166 a_this->core.depth = vinfo->depth;
167 athis.visual = vinfo->visual;
168 if( (vinfo->depth ==DefaultDepth (display,iscreen)) &&
169 (vinfo->visual==DefaultVisual(display,iscreen)) ) {
170 a_this->core.colormap = XDefaultColormap (display,iscreen);
171 athis.installColormap = False;
173 a_this->core.colormap =
174 XCreateColormap (display,XRootWindow(display,iscreen),vinfo->visual, AllocNone);
175 athis.installColormap = True;
177 if(a_this->core.colormap==0L) {
178 CWarn (
"Can't get/create a X colormap.\n");
180 athis.glContext = ::glXCreateContext (display,vinfo,NULL,GL_TRUE);
181 if(athis.glContext==NULL) {
182 athis.glContext = ::glXCreateContext (display,vinfo,NULL,GL_FALSE);
183 if(athis.glContext==NULL) {
184 CWarn (
"Can't create a GLX context.\n");
191 (a_this,ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|KeyPressMask|KeyReleaseMask,0,
event_handler,NULL);
193 #ifdef OPENGLAREA_DEBUG
194 printf(
"debug : OpenGLArea : InitializeWidget : end\n");