Fast OpenGL Application?

Started by
9 comments, last by Fluffy-Bunny 18 years, 1 month ago
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
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
Advertisement
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.
"ok, pac man is an old gameand, there are faces which is eatin up shits" - da madface
SDL is probably the fastest way to get a rendering context set up. Here's a good tutorial.
Another option is using GLUT, check it out...

twitter: @leonidax

website: www.leonidax.com

Or GLFW (my favorite over GLUT and SDL) for that matter...
Olli Salli
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 :)
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
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).
Olli Salli
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.
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
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
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora

This topic is closed to new replies.

Advertisement