Bartek Chaber
Bartek Chaber

Reputation: 338

How to use X11 Pixmap as a OpenGL texture using GLX_EXT_texture_from_pixmap in C?

I have a problem with GLX_EXT_texture_from_pixmap. According to EXT_texture_from_pixmap specification and an example presented there I can use GLXPixmap as a OpenGL texture. However at linking stage I get:

$ gcc -Wall -o uwm main.c -lX11 -lXext -lXcomposite -lXfixes -lGL -lGLU
...
main.c:98:2: warning: implicit declaration of function 'glXBindTexImageEXT' [-Wimplicit-function-declaration]
main.c:(.text+0x651): undefined reference to `glXBindTexImageEXT'

What I have checked:

However Gnome 3 works on this machine with compositing enabled.

My machine has GLX_EXT_texture_from_pixmap extension:

$ glxinfo | grep GLX_EXT_texture_from_pixmap -B 10
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, 
--
    GLX_SGIX_visual_select_group, GLX_INTEL_swap_event
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_framebuffer_sRGB, 
    GLX_MESA_copy_sub_buffer, GLX_MESA_multithread_makecurrent, 
    GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control, 
    GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
    GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap, 
    GLX_INTEL_swap_event
GLX version: 1.4
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, 
    GLX_MESA_multithread_makecurrent, GLX_MESA_swap_control, 
    GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGI_make_current_read, 
    GLX_SGI_swap_control, GLX_SGI_video_sync, GLX_SGIS_multisample, 
    GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, 
    GLX_EXT_texture_from_pixmap

So my questions are:

Upvotes: 3

Views: 2100

Answers (1)

datenwolf
datenwolf

Reputation: 162297

It's a extension, so the reliable way to access it is through the extension mechanism. glXGetProcAddress and friends. I suggest using a ready-to-use extension loader like GLEW.

Upvotes: 2

Related Questions