to know the version i’m using,
please
[This message has been edited by airseb (edited 05-10-2003).]
to know the version i’m using,
please
[This message has been edited by airseb (edited 05-10-2003).]
Hi!
char version = (char)glGetString(GL_VERSION);
hehe…
i have a problem, i do this :
#include <gl\GLAUX.h> #include <gl\glut.h> #include <gl\gl.h> #include <gl\glext.h> #include <iostream.h>
void main ()
{
char version = (char)glGetString(GL_VERSION);
cout <<*version<<endl ;
}
and windows say to me that the program have to close
what’s wrong ?
You have to create a rendering context for any OpenGL function to work.
can you explain me more ?
does it mean that i have to put “char version = (char)glGetString(GL_VERSION);” in the display function ? with a cout ?
airseb, I showed you how to use this function. If you don’t know anything about typecasting you should spend sometime learning C++. Typecasting is operation of turning one type into another. glGetString returns a null terminated string of type const unsigned char*. You can do this:
const unsigned char* glver = glGetString(GL_VERSION);
cout << glVer << endl; // DO NOT PUT A DEREFERENCE OPERATOR infront of glVer
Originally posted by Bob:
You have to create a rendering context for any OpenGL function to work.
What Bob means is you should have OpenGL “initialized” before using any OpenGL functions
GL is initialized only when you have a window opened by your program. So, you cannot access GL in console mode unless you pop up a window.
I guess you are a very beginner. Try GLUT or maybe, even better, go for SDL.
Read the help, see some tutorials on how to pop up a win.
Once you pop up your gl-enabled window (no matter how you do it), you can call all the GL functions from everywhere. You can put it in the main or in the messageProc or in a Render() function.
Little note about your cout:
char *string = “This is a string”;
cout<<*string;
Program output is -->T<-- and not -->This is a string<–.
This is becouse string is a char and not a char so, when cout will process it it will recognize it as a char and output it. I guess you should have to recheck your pointer math and priorities. Understand pointers, they are important in GL and I find them often useful.
EDIT: hey, while typing the message, other messages popped up before this! Woah…
[This message has been edited by Obli (edited 05-10-2003).]
ok it works !
thanks everybody
sorry brian of having done a new topic for that but i didn’t know that an open gl window had to be opened before GL_VERSION.
[This message has been edited by airseb (edited 05-11-2003).]