After one day of very low level debugging I found part of the problem. I'll explain because maybe I'm doing something wrong.
There seem to be a duplicated load of the opengl library, one for statically linked calls and other dynamically loaded. I tried in gdb $> p listVisuals() which calls directly to XGetVisualInfo and worked (found ~84 visuals). then I tried something more interesting, by manually calling display_ioGLcreateContext from gdb, which calls glXChooseVisual. And it worked again. After much debugging, I found that loading glXGetProcAddress dynamically with dlsym from /usr/lib/libGL.so gave an address different to the one gdb gives if directly doing $> p glXGetProcAddress("glXChooseVisual") so there are 2 glXGetProcAddress. This is because one is loaded with dlsym (1) and the other is loaded automatically because the vm is linked against libGL (2). Calling (1) to get addresses of gl functions gives different addresses for all functions than calling (2). Calling glXChooseVisual with the address fetched by (1) fails, but if using (2) it works. This is really strange to me. The way to fix it is to get glXGetProcAddress from NativeBoost VMModule instead of '/usr/lib/libGL.so'. Now with this I have the opengl example almost working in linux (I hope). On Sun, Feb 12, 2012 at 4:23 AM, Igor Stasenko <siguc...@gmail.com> wrote: > ok, so > > If no conforming visual exists, NULL is returned. > It is hard to imagine, that these attributes not supported > > {GLX_RGBA. GLX_DEPTH_SIZE. > 24. > GLX_DOUBLEBUFFER. 0} > > the code seems to be fine. > > This is what i found: > > ------- > http://www.opengl.org/wiki/Programming_OpenGL_in_Linux:_GLX_and_Xlib > > If glXChooseVisual returns with success, the visual's id will be > output. If NULL is returned, there is no visual that fulfills your > needs. In that case, check the output of glxinfo again. Maybe you have > to use a different depth buffer size (GLX_DEPTH_SIZE, 16 instead of > GLX_DEPTH_SIZE, 24), or you could even have to remove the > GLX_DEPTH_SIZE (or the GLX_DOUBLEBUFFER) entry. This should be > considered especially if you want to create programs not only for your > computer, but for other ones: You should code your program in a way > that it can check a list of different combinations of visual > attributes, because the capabilities depend heavily on the hardware. > ----- > They also using > vi = glXChooseVisual(dpy, 0, att); > > second argument = 0. not #defaultScreen. > > yes, I tried all this. first with 0, then with defaultScreen, which returns 0. > On 10 February 2012 19:59, Javier Pimás <elpochodelage...@gmail.com> > wrote: > > yes, notice that it is in a different > > repo: http://www.squeaksource.com/NBXLib > > > > > > On Fri, Feb 10, 2012 at 3:53 PM, Igor Stasenko <siguc...@gmail.com> > wrote: > >> > >> On 10 February 2012 19:48, Javier Pimás <elpochodelage...@gmail.com> > >> wrote: > >> > To load NBOpenGL-X package you need to load NBXLib-core first > >> > > >> i don't see it. did you uploaded it? > >> > >> > > >> > On Fri, Feb 10, 2012 at 3:39 PM, Igor Stasenko <siguc...@gmail.com> > >> > wrote: > >> >> > >> >> Btw, javier i cannot load your package to check what you did: > >> >> > >> >> This package depends on the following classes: > >> >> NBXLibConstants > >> >> You must resolve these dependencies before you will be able to load > >> >> these definitions: > >> >> NBGLXContextDriver > >> >> supportsCurrentPlatform > >> >> createContext: > >> >> > >> >> > >> >> > >> >> > >> >> On 10 February 2012 19:34, Igor Stasenko <siguc...@gmail.com> wrote: > >> >> > On 10 February 2012 19:19, Lawson English <lengli...@cox.net> > wrote: > >> >> >> Is that code even ready for consumption? > >> >> >> > >> >> >> I was told that until there is a new ConfigurationOfNBOpenGL > ready, > >> >> >> to > >> >> >> not > >> >> >> load the new packages. > >> >> >> > >> >> > > >> >> > you could try :) > >> >> > > >> >> > but this is what i working on now (slowly integrating the parts of > >> >> > Javier's code, > >> >> > because not everything which he did i like ;) > >> >> > > >> >> > > >> >> >> L. > >> >> >> > >> >> >> > >> >> >> On 2/10/12 10:12 AM, Javier Pimás wrote: > >> >> >> > >> >> >> I'm trying to create an OpenGL context on linux but > glxChooseVisual > >> >> >> fails. > >> >> >> Maybe there's someone there experienced with this that can help. > >> >> >> > >> >> >> The code I'm trying is: > >> >> >> > >> >> >> display := NBXLibDisplay open. > >> >> >> window := display defaultRootWindow. > >> >> >> visualInfo := NBXLibVisualInfo fromPointer: (gl chooseVisual: > >> >> >> display > >> >> >> screen: display defaultScreen attributes: {GLX_RGBA. > GLX_DEPTH_SIZE. > >> >> >> 24. > >> >> >> GLX_DOUBLEBUFFER. 0} asWordArray). > >> >> >> ... > >> >> >> > >> >> >> but chooseVisual returns a null pointer. I even tried putting an > >> >> >> array > >> >> >> with > >> >> >> only 0 on attributes but didn't work either (and these attributes > >> >> >> should be > >> >> >> supported). > >> >> >> > >> >> >> Any idea of what could be wrong? The code is available to test in > >> >> >> squeaksource, you need nativeboost+NBXLib to try > >> >> >> > >> >> >> Cheers, > >> >> >> Javier > >> >> >> > >> >> >> -- > >> >> >> Lic. Javier Pimás > >> >> >> Ciudad de Buenos Aires > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > Best regards, > >> >> > Igor Stasenko. > >> >> > >> >> > >> >> > >> >> -- > >> >> Best regards, > >> >> Igor Stasenko. > >> >> > >> > > >> > > >> > > >> > -- > >> > Lic. Javier Pimás > >> > Ciudad de Buenos Aires > >> > >> > >> > >> -- > >> Best regards, > >> Igor Stasenko. > >> > > > > > > > > -- > > Lic. Javier Pimás > > Ciudad de Buenos Aires > > > > -- > Best regards, > Igor Stasenko. > > -- Lic. Javier Pimás Ciudad de Buenos Aires