Why is glGetString(GL_VERSION)==NULL ?

Why is glGetString(GL_VERSION)==NULL ?

Post by Cass Everit » Tue, 07 Oct 1997 04:00:00






> | Hi,  I'm trying to query the OpenGL version, and I keep getting a NULL
> | pointer returned by glGetString(GL_VERSION).  What gives?

> Looks like you haven't created any windows, and therefore you haven't
> created any OpenGL rendering contexts.  Without a current rendering
> context, glGetString() can't do anything useful.

On that point, would it be possible within the same program
to have multiple contexts, each with different versions?

                                Just curious -
                                        Cass

--
-------------------------------------------------------
Cass W. Everitt         Mississippi State University

Phone: 601/325-1451     P.O. Box 9627
Fax:   601/325-7692     Mississippi State, MS 39762
WWW:   http://www.erc.msstate.edu/~cass

 
 
 

Why is glGetString(GL_VERSION)==NULL ?

Post by Andrew T Duchows » Tue, 07 Oct 1997 04:00:00


Hi,  I'm trying to query the OpenGL version, and I keep getting a NULL
pointer returned by glGetString(GL_VERSION).  What gives?

I'm running on an Indigo2 XZ, Irix 6.2, OpenGL v1.0 (no GL_VERSION_1_1
in the <gl.h> file---so I know the version, but I'd still like to
see the glGetString(GL_VERSION) call to work, cause it really burns
me when something doesn't work "as advertised" in the Programming
Guide (v1.1, maroon)).

---------------------------- Code fragments:
#include        <stdio.h>
#include        <stdlib.h>
#include        <string.h>
#include        <math.h>
#include        <sys/types.h>
#include        <GL/gl.h>
#include        <GL/glut.h>

int main(int argc,char **argv)
{
        char    *info;

  glutInit(&argc,argv);
  do_comd_opts(argc,argv);

  info = (char *)glGetString(GL_VERSION);
  fprintf(stdout,"OpenGL version: %s\n",info);
  info = (char *)glGetString(GL_EXTENSIONS);
  fprintf(stdout,"OpenGL extensions: %s\n",info);
  info = (char *)gluGetString(GLU_VERSION);
  fprintf(stdout,"GLU Version: %s\n",info);
  info = (char *)gluGetString(GLU_EXTENSIONS);
  fprintf(stdout,"GLU Extensions: %s\n",info);

Quote:}

---------------------------- Compilation libs:
-lmui -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm -ldmedia

---------------------------- Output:
OpenGL version: (null)
OpenGL extensions: (null)
GLU Version: 1.2 Irix 6.1
GLU Extensions:

--
Andrew T Duchowski               office:HRBB.414A
Computer Science Dept., MS-3112  phone:409/845.9980   fax:409/847.8578

College Station, TX  77843-3112  http://www.cs.tamu.edu/people/andrewd

 
 
 

Why is glGetString(GL_VERSION)==NULL ?

Post by Allen Ak » Tue, 07 Oct 1997 04:00:00




| Hi,  I'm trying to query the OpenGL version, and I keep getting a NULL
| pointer returned by glGetString(GL_VERSION).  What gives?

Looks like you haven't created any windows, and therefore you haven't
created any OpenGL rendering contexts.  Without a current rendering
context, glGetString() can't do anything useful.

Allen

 
 
 

Why is glGetString(GL_VERSION)==NULL ?

Post by Brian Pa » Wed, 08 Oct 1997 04:00:00



Quote:> Hi,  I'm trying to query the OpenGL version, and I keep getting a NULL
> pointer returned by glGetString(GL_VERSION).  What gives?

> I'm running on an Indigo2 XZ, Irix 6.2, OpenGL v1.0 (no GL_VERSION_1_1
> in the <gl.h> file---so I know the version, but I'd still like to
> see the glGetString(GL_VERSION) call to work, cause it really burns
> me when something doesn't work "as advertised" in the Programming
> Guide (v1.1, maroon)).
> ...

glGetString(), like most (all?) other GL commands do nothing until a
rendering context has been bound.  In your GLUT program you should create
a window before calling glGetString().  This will setup a context for you.

The reason is that glGetString()'s result depends on the renderer (X
server) that is being used.  The version, vendor, extensions, etc all
depend on that and can't be resolved until the context has been made
current.

-Brian

--------------------------------------------------------------------

 
 
 

Why is glGetString(GL_VERSION)==NULL ?

Post by Himanshu Goh » Wed, 08 Oct 1997 04:00:00


NOTE: Please remove XXX from my email address to reply directy!


Quote:>Hi,  I'm trying to query the OpenGL version, and I keep getting a NULL
>pointer returned by glGetString(GL_VERSION).  What gives?

Ooooh...I've been there before!  Frustrating, isn't it?

Seems like the call to glGetString() works only _after_ the window
has been mapped!

NOTE: Please remove XXX from my email address to reply directy!

--

Geometric Modeling/Graphics Research Group, U of South Florida, Tampa,FL
Research Group URL: http://www.csee.usf.edu/graphics/

 
 
 

Why is glGetString(GL_VERSION)==NULL ?

Post by Allen Ak » Wed, 08 Oct 1997 04:00:00




|
| On that point, would it be possible within the same program
| to have multiple contexts, each with different versions?

Yes.  Programs that draw to multiple devices often will find that
contexts have different version or extension strings.  In the X11
world, this could happen when a program accesses displays over the
network; in both the Windows and X11 worlds, this could happen when a
machine has several graphics devices (displays or printers) of
differing types.

Allen

 
 
 

1. glGetString(GL_VERSION) and extensions

The spec does not specify that the major.minor number returned by
glGetString(GL_VERSION) corresponds to the OpenGL spec number.  ie any
OpenGL 1.1 returns at least "1.1" or "1.1.xxx ...".  Or is it implied?

From the 1.1 and 1.2 specs:
] the VERSION string is laid out as follows:
]
] <version number><space><vendor-specific information>
]
] The version number is either of the form major_number.minor_number or
] major_number.minor_number.release_number, where the numbers all have ]
one or more digits. The vendor specific
] information is optional. However, if it is present then it pertains to
] the server and the format and contents are
] implementation dependent.

NOW, assuming that GL_VERSION "1.1" means OpenGL 1.1, then the
implementation must implement all the extensions that were rolled into
1.1 (EXT_blend_logic_op, EXT_copy_texture, EXT_polygon_offset,
EXT_subtexture, EXT_texture, EXT_texture_obj, EXT_vertex_array) and thus
doesn't need to include them in GL_EXTENSIONS.  Is this correct?

The 1.2 spec (D.6 Texture Coordinate Edge Clamping) states: "The
additions match those of the SGIS_texture_edge_clamp extension."  Should
this be EXT_texture_edge_clamp, or did 1.2 turn the first into the
second?

Ditto for D.7 and SGIS_texture_lod.

--
- Philippe F. Bertrand
Software Architect, Visual Insights Inc,
http://www.VisualInsights.com

Sent via Deja.com http://www.deja.com/
Before you buy.

2. material library

3. glGetString(GL_VERSION) not working under Windows NT, SP3

4. Dividing Polygons

5. glGetString() always returns (null)

6. Help w/ modifying POV-Ray source

7. Getting NULL insted of information from glGetString(GLenum)

8. glGetString returns NULL

9. Why doesn't glGetString work?

10. Q: Am I missing something here with nulls?

11. Why would Action::state be NULL?

12. Hrlp: why to flicking when not set TImage stretch property is true ;(null)