Thread View: comp.graphics.api.opengl
3 messages
3 total messages
Started by Dr. Antoni Kajetan Wisor
Wed, 20 Oct 1999 00:00
Getting NULL insted of information from glGetString(GLenum)
Author: Dr. Antoni Kajetan Wisor
Date: Wed, 20 Oct 1999 00:00
Date: Wed, 20 Oct 1999 00:00
36 lines
1725 bytes
1725 bytes
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:
#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();
/* 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);
glFlush();
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
Re: Getting NULL insted of information from glGetString(GLenum)
Author: Marcin Romaszewicz
Date: Wed, 20 Oct 1999 00:00
Date: Wed, 20 Oct 1999 00:00
46 lines
1968 bytes
1968 bytes
You must have a valid rendering context before you can call glGetString.
Open up a window, get a context, and then call glGetString and you will
get the correct behavior.
-- Marcin
"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:
>
> #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();
>
> /* 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);
>
> glFlush();
>
> 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
Re: Getting NULL insted of information from glGetString(GLenum)
Author: Phil Frisbie, Jr.
Date: Thu, 21 Oct 1999 00:00
Date: Thu, 21 Oct 1999 00:00
59 lines
2251 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads