Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BestOllier

OpenGL beginner help!

This topic is 5225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

what are some good opengl compatible compilers? when i try to use dev c++ it stops copiling when it gets to the opengl required includes.

Share this post


Link to post
Share on other sites
Advertisement
What do you mean it stops? It just stop with no messages?
Good OpenGL compatible compiler? Dev-C++ is as good as any...

Perhaps you could elaborate...would be so much easier to give an accurate answear...

Share this post


Link to post
Share on other sites
sure,

i got this code to draw a cube online

----------------------------------------------------------

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}

void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity (); /* clear the matrix */
/* viewing transformation */
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glScalef (1.0, 2.0, 1.0); /* modeling transformation */
glutWireCube (1.0);
glFlush ();
}

void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}

---------------------------------------------------------

the compiler stops and abunch of errors appear at the compiler box at the bottom of the screen. i think it may have something to do with the #include <GL/glut.h> because one of the errors says "GL/glut.h: no such file or directory". is there something i have to download? or am i just too much of a n00b?

Share this post


Link to post
Share on other sites
compilers search for #included files on their PATH ... just like in the days of DOS when you added programs to your path so other programs could find them ...

I don''t use Dev-C++ but most compilers have 1 of the following:

1. A way to add a directory to the search path for all projects (a way to configure the compiler path).

2. A way to add a directory to the search path for a given project.

3. A command line option to add a directory to the path for a particular execution.

often it is the -i or -I option ...

Of course, this means you would have to have a directry called "GL" and inside of it would have to be files called "gl.h" "glu.h" and "glut.h" ...

I know that to get GLUT for Visual Studio 6, I had to go download glut, and add the glut.h files to my GL directory myself.

Visual Studio 6 already had a "GL" root directory with "gl.h" and "glu.h" I believe ... so seach your computer for "gl.h" and see if it finds it anywhere ...

Share this post


Link to post
Share on other sites
Dev C++ comes with the required libraries for openGL (or at least it did with the old version I use). If you create a new project, and then select the option for an openGL project, you can open up a demo openGL project that comes with the compiler. So try compiling that and see if it works, and if it does, you can look at the project options to see any linker command you might be missing out.

I use dev cpp for openGL with no problems, by including
#include <gl/gl.h>
#include <gl/glu.h>
at the top of source files,
and adding -lopengl32 -lglu32 onto "linker options"

*edit* after reading your posts more carefully (doh) I noticed that you're just having problems with glut, not opengl itself.
Download the windows port of glut from
here, then
copy glut.h to your dev-cpp/include/gl directory, and change the third line of it to "#define GLUT_DISABLE_ATEXIT_HACK"

then, include (as you're already doing) and in the project settings screen add -lglut (and possibly -lglut32) to linker options. It's been a while since I used glut, so I hope that works...

[edited by - MetaL on June 5, 2004 12:27:01 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!