🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.api.opengl
Article #22

Re: Getting NULL insted of information from glGetString(GLenum)

#22
From: Phil Frisbie, Jr.
Date: Thu, 21 Oct 1999 00:00
59 lines
2251 bytes
Dr. Antoni Kajetan Wisor wrote:
> 
> Hi folks!
> 
> I have a small problem with OpenGL. Because I am not very deep in this topic, I
> do not know what to do further. If any one can help me, please post it. Here is
> an excerpt of my problem, which should run without any problem after
> compilation:

You are wrong, this program should NOT run.

> 
> #include <stdio.h>              //Standard C I/O functions
> #include <windows.h>            //For Win32-API Applications
> #include <gl/gl.h>              //OpenGL
> 
> /* Declaration of prototypes */
> LONG __cdecl main();

First, the proper prototype for main is:

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

> /* Mainprog */
> 
> LONG __cdecl main()
> {
>   char* vendor = (char*)glGetString((GLenum)GL_VENDOR);
>   char* renderer = (char*)glGetString((GLenum)GL_RENDERER);
>   char* version = (char*)glGetString((GLenum)GL_VERSION);
>   char* extensions = (char*)glGetString((GLenum)GL_EXTENSIONS);

You cannot call OpenGL functions without creating a context and making
it current. To create a context you need to create a window, so you
might as well start with a full Windows app instead of a console app. Or
use GLUT to avoid the Windows API.

> 
>   glFlush();

There is no reason to cal glFlush if you have not rendered anything.

> 
>   printf("Vendor: %s\n", vendor);
>   printf("Renderer: %s\n", renderer);
>   printf("Version: %s\n", version);
>   printf("Extensions: %s", extensions);
> 
>   return (LONG)0;
> }
> 
> Thanks!
> 
> Jakob Wisor


Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com
Technical Details
Message-ID: <380F371D.C5F3D58C@hawksoft.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <380E1E8F.6275AFA@cityweb.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f65bb,89bcb65e54c50f64
X-Google-Attributes: gidf65bb,public
X-Google-Thread: f4527,89bcb65e54c50f64
X-Google-Attributes: gidf4527,public
From: "Phil Frisbie, Jr." <phil@hawksoft.com>
Subject: Re: Getting NULL insted of information from glGetString(GLenum)
Date: 1999/10/21
Message-ID: <380F371D.C5F3D58C@hawksoft.com>
X-Deja-AN: 538885225
Content-Transfer-Encoding: 7bit
References: <380E1E8F.6275AFA@cityweb.de>
Organization: Hawk Software
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: comp.graphics.api.opengl,3dfx.linux.dev.opengl