PDA

View Full Version : glXChooseVisual returns always NULL!



santyhamer
06-06-2002, 05:11 AM
I am using Red Hat 7.1 ( kernel smp ) with NVidia drivers 29.60. I installed the NVIDIA_GLX-1.0-2960.i386.rpm and NVIDIA_kernel-1.0-2960.rh71smp.i686.rpm.

This is my current crashed code:


static int sngBuf[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 12,
None };

static int dblBuf[] = { GLX_USE_GL,
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_DOUBLEBUFFER,
None };

static int defBuf[] = { GLX_RGBA, None };
dpy = XOpenDisplay ( 0 );
if (0==dpy)
{
fatalError("could not open display");
}

/* Step 2. Make sure OpenGL's GLX extension is supported. The
glXQueryExtension also returns the GLX extension's error base and event
base. For almost all OpenGL programs, this information is irrelevant;
hence the use of dummy.*/
if(!glXQueryExtension(dpy, &dummy1, &dummy2))
{
fatalError("X server has no OpenGL GLX extension");
}

2 /* Step 3. Find an appropriate OpenGL-capable visual. Look for double
buffering first; if it is not found, settle for a single buffered visual.*/
vi = glXChooseVisual ( dpy, DefaultScreen(dpy), defBuf/*dblBuf*/);
if ( 0==vi )
{
vi = glXChooseVisual (dpy, DefaultScreen(dpy), sngBuf);
if ( 0==vi )
{
fatalError("no RGB visual with depth buffer");
}

doubleBuffer = false;
}

andy1
06-06-2002, 06:36 AM
Hi,

GLX_RGBA, GLX_USE_GL, and GLX_DOUBLEBUFFER have to be followed by either True or False.

Andy



[This message has been edited by andy1 (edited 06-06-2002).]

CopyCat
06-06-2002, 07:09 AM
No they don't have to be followed by t/f.
I would suggest running glxinfo if GL may be used etc http://www.opengl.org/discussion_boards/ubb/smile.gif

I use this attr flags.
static int gl_attr[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None
};

santyhamer
06-06-2002, 07:52 AM
glxinfo tells me all r,g,b,a bits are 0 and " couldnt find RGB GLX info"... I think i havent the correct XFree86 version ( it should be 4.0.2 ... ). How can I find the current XFree86 version?

06-10-2002, 12:01 AM
You could type "rpm -q XFree86" to check the version. More likely is that you missed something else when you installed the nvidia driver. You should have documentation in /usr/share/doc/NVIDIA_GLX-1.0/

Check that you do not are used a 8 bit 256 color mode.

CopyCat
06-10-2002, 05:24 AM
To check the X version write at console/terminal X -version ( not --version but -version ).
You should have loaded glx moadule too ( in XF86 config file in Section "Module" write Load "glx" or somthing like that http://www.opengl.org/discussion_boards/ubb/smile.gif

CopyCat
06-10-2002, 05:26 AM
Btw. Instaling just the drivers doesn't doo anything.
You should configure the X-serevr too http://www.opengl.org/discussion_boards/ubb/smile.gif

santyhamer
06-11-2002, 01:56 AM
hehe.... I installed bad the NVidia drivers... I replaced "nv" at Device part by "nvidia" and all problems were solved...

Thanx to all.