Re: Using Mesa (openGL) with GTK



Juergen A. Erhard (jae@laden.ilk.de) wrote:
>It works for me after changing dbuf in gui_init to start with GL_RGBA
>and put the GLX_DOUBLEBUFFER at the end. Took me a couple minutes, and
>comparing with glxdemo.c in Mesa 2.3...

I also inserted GLX_RGBA, but doing just that that doesn't work well at
all, since the toplevel widget gets the default visual (In my case 
PseudoColor 8), and then the program tries to attach the TrueColor 24
visualled glarea widget to it.

The results are some pretty nasty kernel messages about failed asserts
and the GL rendering seems to be in black&white. (not grayscale, B&W)

This should really be possible to do, as it seems there is an OpenGL
widget for motif that can do it. (As seen in Mark Kilgards excellent
article from the X Journal, which can be found at
http://www.sgi.com/Technology/openGL/mjk.motif/  )
I don't know how though.

The fix I've found is to force the entire app to use the best visual it
can find. That works on my system (Sparc Solaris 2.5.1, OpenGL 1.0) at 
least. What I did to the posted code was:

1: Add GLX_RGBA to the dbuf[] array.

2: Add

  gtk_widget_set_default_visual (gtk_preview_get_visual ());
  gtk_widget_set_default_colormap (gtk_preview_get_cmap ());

just after the call to gtk_init().

You mention changing the order of the members of the attriblist to
glXChooseVisual, does this have any effect? 
 
>And if anyone has to add something that should be changed before
>trying to use it in bigger project, go ahead. It's
>shameless-plug-time: I'll be using it in MARS, the Modelling Animation
>and Rendering System. Come to
>http://members.tripod.com/~Juergen_Erhard/mars_index.html and check it
>out...

I couldn't reach this URL, are you sure it's correct?
 
/August.
-----BEGIN MOF (My Own Forehead) SIGNATURE----
yt6g7bfr5de5gy6bh7unjim8kojm7ynh6btgvfrcdeuy7ji87jy6htbgvrf5ced5t6gy7uhnji8
67gyf8u7jyhi7y67h9mkHjjfufhg7unji8mkhyb6tgvrfcdeg6yb7hunj87yu8jikmoyh
-----END MOF SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]