Fast OpenGL Application?
What is the best way to create an application which supports OGL?
I want to make a simple window with a textured box or whatever, I have the code from nehe, but is that the best and fastest way? Anyone has an example of fast window creation + OGL?
Thank you very much :)
Decrius
NeHe tells you how to create a window and stuff. They also include full source code for a working program, window and all. The links are on the bottom of his tutorial pages.
If you don't want to use NeHe's method, you could use SDL_OpenGL to make a window and get input and stuff, Google will find you some good examples of that.
If you don't want to use NeHe's method, you could use SDL_OpenGL to make a window and get input and stuff, Google will find you some good examples of that.
Thanks for all the reply's!
I'll try GLUT cos I saw more tuts about it haha :p
However, its not working:
Project : OpenGL Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\C\Projects\GLUT_Window--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\C\Projects\GLUT_Window\GLUT.exe
.objs\main.o:main.cpp:(.text+0x48): undefined reference to `glutInit'
.objs\main.o:main.cpp:(.text+0x5c): undefined reference to `glutInitWindowPosition'
.objs\main.o:main.cpp:(.text+0x70): undefined reference to `glutInitWindowSize'
.objs\main.o:main.cpp:(.text+0x7c): undefined reference to `glutCreateWindow'
.objs\main.o:main.cpp:(.text+0x88): undefined reference to `glutDisplayFunc'
.objs\main.o:main.cpp:(.text+0x9f): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
The glut operations dont work for a weird reason. I Included the latest glut library file for the latest glut .dll file, and added the latest glut .h file. What could else be wrong?
Code:
#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/add/glut.h>
bool init()
{
return true;
}
void display()
{
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(50, 50);
glutInitWindowSize(500, 500);
glutCreateWindow("01 - GLUT Window");
glutDisplayFunc(display);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}
Noone of the functions are working :S.
Any help will be appreciated :)
I'll try GLUT cos I saw more tuts about it haha :p
However, its not working:
Project : OpenGL Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\C\Projects\GLUT_Window--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\C\Projects\GLUT_Window\GLUT.exe
.objs\main.o:main.cpp:(.text+0x48): undefined reference to `glutInit'
.objs\main.o:main.cpp:(.text+0x5c): undefined reference to `glutInitWindowPosition'
.objs\main.o:main.cpp:(.text+0x70): undefined reference to `glutInitWindowSize'
.objs\main.o:main.cpp:(.text+0x7c): undefined reference to `glutCreateWindow'
.objs\main.o:main.cpp:(.text+0x88): undefined reference to `glutDisplayFunc'
.objs\main.o:main.cpp:(.text+0x9f): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
The glut operations dont work for a weird reason. I Included the latest glut library file for the latest glut .dll file, and added the latest glut .h file. What could else be wrong?
Code:
#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/add/glut.h>
bool init()
{
return true;
}
void display()
{
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(50, 50);
glutInitWindowSize(500, 500);
glutCreateWindow("01 - GLUT Window");
glutDisplayFunc(display);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}
Noone of the functions are working :S.
Any help will be appreciated :)
Add -lglut to the linker options in your IDE's project settings. If it complains about not finding -lglut, add -Lpath:\to\your\glut.lib (or libglut.a or whatever it's called in those weird mingw systems, dunno, find out for yourself).
Oh sorry, forgot to explain, the linker files are:
-lopengl32
-lglu32
-lglut32 (or -lglut or -glut)
Its stays saying the same :(
Thanks for the reply anyways.
-lopengl32
-lglu32
-lglut32 (or -lglut or -glut)
Its stays saying the same :(
Thanks for the reply anyways.
It's very important that the dll and the static lib are the same version ... but reading your post again it seems like you already have that under control. *shrug* worth checking again I guess. Maybe try a different source for the libs?
For a weird reason its working now :).
Maybe is anyone familiar with GLUt, because I want to know if there is an easy way of quiting the program, the code: (how to make the code textfields in this forum?)
...
...
void keyboard(unsigned char key)
{
switch(key)
{
// Escape
case 27 :
[do sumthing]
break;
}
}
int main(int argc, char *argv[])
{
...
...
glutKeyboardFunc(keyboard);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}
Now I was wondering if I could stop the MainLoop (or whatever thing to stop the program running) by pressing Escape. I can build a whole function around it (maybe), but maybe one of u guys has an idea?
Thanks for the help :D
Maybe is anyone familiar with GLUt, because I want to know if there is an easy way of quiting the program, the code: (how to make the code textfields in this forum?)
...
...
void keyboard(unsigned char key)
{
switch(key)
{
// Escape
case 27 :
[do sumthing]
break;
}
}
int main(int argc, char *argv[])
{
...
...
glutKeyboardFunc(keyboard);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}
Now I was wondering if I could stop the MainLoop (or whatever thing to stop the program running) by pressing Escape. I can build a whole function around it (maybe), but maybe one of u guys has an idea?
Thanks for the help :D
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement