From: Carlos P. <jos...@is...> - 2010-03-24 19:50:35
|
Hi, I apologize, these are essentialy GLX and X questions, not Mesa, I just don't know where else to ask this... I am trying to use only <GL/glx.h> to write a GTK/OpenGL app. It is working fine, though I still have some few questions, mainly regarding memory leaks: 1) The sintax for this list of attributes is correct? Shall I improve it somehow? it works for me... int attributes[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, True, GLX_DEPTH_SIZE, 12, None }; XVisualInfo *visual_info; visual_info = glXChooseVisual (display, screen, attributes); 2) free visual_info immediately after creating the context, when it is no longer needed? it works for me... XVisualInfo *visual_info; visual_info = glXChooseVisual (display, screen, attributes); ... context = glXCreateContext (display, visual_info, NULL, TRUE); XFree (visual_info); <<<<<<<<<< 3) free context and colormap when the GL window is removed? it works for me... colormap = XCreateColormap (display, root, visual_info->visual, AllocNone); context = glXCreateContext (display, visual_info, NULL, TRUE); ... glXDestroyContext (display, context); <<<<<<<< XFreeColormap (display, colormap); <<<<<<<<<< 3) Shall I free visual_info->visual in the end, when closing the app? I am not sure... I suppose the answer is no? XVisualInfo *visual_info; Thank you very much for your help... (I posted two fully working examples, one using GLX, the other GTKGLExt, at: http://www.gamgi.org/gtk_opengl.tar.gz). Carlos |