PDA

View Full Version : DRI error



Rex
09-02-2005, 02:16 PM
I am trying to run a program that will overlay openGL lines and text on a video picture. The system I am using has a proprietary linux video board that will not allow direct rendering. The linux version is Red Hat 9.

I am trying to use the program odg_glx_sample, by Kevin Harris as a starting point, and interleave its commands with those needed to bring in the video.

The program fails at the command:

XmapWindow( g_pDisplay, g_window);

with the message:

Xlib: extension "XFree86-DRI" missing on display ":0.0"

The program up to this point is as follows:

int main( int argc, char **argv )
{
XSetWindowAttributes windowAttributes;
// seems to be needed for video
XVisualInfo *visualInfo = NULL;
XEvent event;
Colormap colorMap;
GLXContext glxContext;
KeySym keysym;

int errorBase;
int eventBase;
// default to PAL input for video
int nStandard=ID_PAL;

// Open a connection to the X server
g_pDisplay = XOpenDisplay( NULL );
scr= DefaultScreenOfDisplay(g_pDisplay);

if( g_pDisplay == NULL )
{
fprintf(stderr, "glxsimple: %s\n", "could not open display");
exit(1);
}

// Make sure OpenGL's GLX extension supported
if( !glXQueryExtension( g_pDisplay, &errorBase, &eventBase ) )
{
fprintf(stderr, "glxsimple: %s\n", "X server has no OpenGL GLX
extension");
exit(1);
}

// Find an appropriate visual

int doubleBufferVisual[] =
{
GLX_RGBA, // Needs to support OpenGL
GLX_DEPTH_SIZE, 16, // Needs to support a 16 bit depth buffer
GLX_DOUBLEBUFFER, // Needs to support double-buffering
None // end of list
};

int singleBufferVisual[] =
{
GLX_RGBA, // Needs to support OpenGL
GLX_DEPTH_SIZE, 16, // Needs to support a 16 bit depth buffer
None // end of list
};

// Try for the double-bufferd visual first
visualInfo = glXChooseVisual( g_pDisplay, DefaultScreen(g_pDisplay),
doubleBufferVisual );

if( visualInfo == NULL )
{
fprintf(stderr, "No dobule buffer.\n");
// If we can't find a double-bufferd visual, try for a single-buffered
visual...
visualInfo = glXChooseVisual( g_pDisplay, DefaultScreen(g_pDisplay),
singleBufferVisual );

if( visualInfo == NULL )
{
fprintf(stderr, "glxsimple: %s\n", "no RGB visual with depth
buffer");
exit(1);
}

g_bDoubleBuffered = false;
}

WM_PROTOCOLS = XInternAtom(g_pDisplay,"WM_PROTOCOLS",false);
WM_DELETE_WINDOW = XInternAtom(g_pDisplay,"WM_DELETE_WINDOW",false);

// Create an OpenGL rendering context
glxContext = glXCreateContext( g_pDisplay,
visualInfo,
NULL, // No sharing of display lists
GL_FALSE ); // Direct rendering if possible

if( glxContext == NULL )
{
fprintf(stderr, "glxsimple: %s\n", "could not create rendering
context");
exit(1);
}

// Create an X colormap since we're probably not using the default visual
colorMap = XCreateColormap( g_pDisplay,
RootWindow(g_pDisplay, visualInfo->screen),
visualInfo->visual,
AllocNone );

windowAttributes.colormap = colorMap;
windowAttributes.border_pixel = 0;
windowAttributes.event_mask = ExposureMask |
VisibilityChangeMask |
KeyPressMask |
KeyReleaseMask |
ButtonPressMask |
ButtonReleaseMask |
PointerMotionMask |
StructureNotifyMask |
SubstructureNotifyMask |
FocusChangeMask;

// Create an X window with the selected visual
g_window = XCreateWindow( g_pDisplay,
RootWindow(g_pDisplay, visualInfo->screen),
0, 0, // x/y position of top-left outside
corner of the window
640, 480, // Width and height of window
0, // Border width
visualInfo->depth,
InputOutput,
visualInfo->visual,
CWBorderPixel | CWColormap | CWEventMask,
&windowAttributes );
// win=RootWindowOfScreen(scr);

XChangeProperty(g_pDisplay,g_window, WM_PROTOCOLS, XA_ATOM, 32,
PropModeReplace,
(unsigned char *) &WM_DELETE_WINDOW, 1);
printf("before InitVAC.\n");
// intialize for video display
InitVAC(g_window,g_pDisplay);
printf("after InitVAC.\n");

XSetStandardProperties( g_pDisplay,
g_window,
"GLX Sample",
"GLX Sample",
None,
argv,
argc,
NULL );
printf("before MakeCurrent.\n");
// Bind the rendering context to the window
glXMakeCurrent( g_pDisplay, g_window, glxContext );
printf("after MakeCurrent, but before XMap.\n");
// Request the X window to be displayed on the screen
XMapWindow( g_pDisplay, g_window );
printf("after Xmap.\n");

What can I do to avoid the need for DRI?

Thank you,

Rex

Hlz
09-02-2005, 08:24 PM
You'll probably get more responses in the Linux forum.