glGetString returns NULL

glGetString returns NULL

Post by .shift » Mon, 30 Jun 2003 12:50:09



Anyone know why this is?
It did work when I was running linux, now under win2k, the functions return
NULL.
I have tried including MS-SDK gl files, NVIDIA SDK gl files.
Thanks for the help

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
#pragma comment( lib, "OpenGL32.lib")
#pragma comment( lib, "Glu32.lib")

int WINAPI WinMain ( HINSTANCE hinstance,
                                           HINSTANCE hPrevInstance,
                                           LPSTR lpCmdLine,
                                           int nShowCmd )
{

const GLubyte* EXT_string;
const GLubyte* vendor;
const GLubyte* version;
char *filename = "OpenGL_Extensions.txt";
FILE *outfile;

outfile = fopen(filename, "w");
if(!outfile)
{
MessageBox(NULL, "Error opening file", "Error", MB_OK);
return EXIT_FAILURE;

Quote:}

fprintf(outfile, "%s", glGetString(GL_VENDOR));
fprintf(outfile, "%s", glGetString(GL_VERSION));
fprintf(outfile, "%s", glGetString(GL_EXTENSIONS));
fclose(outfile);

return 0;

Quote:}

--
-- does fuzzy logic tickle?
 
 
 

glGetString returns NULL

Post by .shift » Mon, 30 Jun 2003 13:28:08


bleh, nm... figured it out....
its becuase i didn't even initialize GL... so where the hell am
I supposed to get all this info from right??
*sigh*
<-- me is stupid sometimes..


Quote:> Anyone know why this is?
> It did work when I was running linux, now under win2k, the functions
return
> NULL.
> I have tried including MS-SDK gl files, NVIDIA SDK gl files.
> Thanks for the help

> #include <windows.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <GL/gl.h>
> #include <GL/glu.h>
> #include <GL/glext.h>
> #pragma comment( lib, "OpenGL32.lib")
> #pragma comment( lib, "Glu32.lib")

> int WINAPI WinMain ( HINSTANCE hinstance,
>                                            HINSTANCE hPrevInstance,
>                                            LPSTR lpCmdLine,
>                                            int nShowCmd )
> {

> const GLubyte* EXT_string;
> const GLubyte* vendor;
> const GLubyte* version;
> char *filename = "OpenGL_Extensions.txt";
> FILE *outfile;

> outfile = fopen(filename, "w");
> if(!outfile)
> {
> MessageBox(NULL, "Error opening file", "Error", MB_OK);
> return EXIT_FAILURE;
> }

> fprintf(outfile, "%s", glGetString(GL_VENDOR));
> fprintf(outfile, "%s", glGetString(GL_VERSION));
> fprintf(outfile, "%s", glGetString(GL_EXTENSIONS));
> fclose(outfile);

> return 0;
> }

> --
> -- does fuzzy logic tickle?


 
 
 

1. glGetString() always returns (null)

This piece of code only returns four (null).
Is that normal or my code is just not correct?
I'm under linux using NVidia 3123 drivers on a pine TNT2
compiled like this: gcc -o GLext Glext.c -lGL -Wall

#include <stdio.h>
#include <GL/gl.h>

int main(void)
{
        char *vendor;           /* GL_VENDOR     */
        char *renderer;         /* GL_RENDERER   */
        char *version;          /* GL_VERSION    */
        char *ext;              /* GL_EXTENSIONS */

        vendor = (char *) glGetString(GL_VENDOR);
        printf("%s\n", vendor);

        renderer = (char *) glGetString(GL_RENDERER);
        printf("%s\n", renderer);

        version = (char *) glGetString(GL_VERSION);
        printf("%s\n", version);

        ext = (char *) glGetString(GL_EXTENSIONS);
        printf("%s\n", ext);

        return 0;

2. SIGKids Research Showcase Call

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

4. How to use layer grouping?

5. Why is glGetString(GL_VERSION)==NULL ?

6. animation to 16mm film?

7. Viewkit menuItem->baseWidget returns NULL

8. NEED MARBLE (STONE)

9. glxChooseVisual returns NULL

10. wglAllocateMemoryNV() returns NULL if priority=0.5

11. glGetError returns GL_INVALID_OPERATION after wglMakeCurrent NULL

12. gl_vendor returns NULL instead of the vendor name

13. CreateEnhMetafile returns NULL