Advertisement

integrating GLUT and using it

Started by April 24, 2003 03:58 AM
2 comments, last by Reiken 21 years, 10 months ago
I have recently been getting into graphics librareis after I had learnt C++, and I was looking to learn GLUT (because of the complex nature of other graphics libraries such as OpenGL and Direct X). Although I am unable to integrate the GLUT libraies into my C++ directory (I am using DevC++), mainly because I don''t know how to and because I can''t find any instuctions or readme with the files. If anyone can give some help it would be much appreciated. >> Reiken Chan
Before you look at glut as a solution, you have to reaslise that glut doesn't really solve anything other than multiple platform issues (such as window creation).

For fear of stepping on someone's toes, saying something stupid and being flamed I'll leave it there, other than to say....

Consider alternatives for multiple platform solutions such as
GLuT
SDL
( maybe others :o )

If you are still happy to go with glut, read up on the installation.
I don't think it should be too hard to work out where to put the .h in difference to the VC++ link above.


EDIT: Just found some more info:


1) first step, download GLUT from the sites in the URL sections.
2) Unpack it to a temporary folder
3) Copy the files as follow:


glut.h -> C:\Dev-C++\Include\Gl\
glut32.lib -> C:\Dev-C++\Lib\


Using:

Windows NT or2000: glut32.dll -> C:\WINNT\system32\
Windows 98: glut32.dll -> C:\WINDOWS\SYSTEM\


(My Dev-C++ folder is C:\Dev-C++\)

· glut.lib and glut.dll can be discarded.
· Note that if you are using only mingw, look for Include\GL and Lib under its install path.

>> Testing the setup


Create a new project:
File->New Project.
Select Console Aplication.

It will ask for a name, folder, etc, etc. Answer that.
After all, you will notice a project and a Untitled file.
You can paste the Appendix A program at this empty file, or remove it and include your separate source file.
After that, go to:
Project->Project Options, box "Further object files or linker options"

Paste this: -lopengl32 -lglu32 -lglut32

Click Ok, Compile and Run the program.
If it worked ok, congratulations, you are ready to play with OGL in Win32 with no extra money spent.


[edited by - Juicy on April 24, 2003 5:53:55 AM]
I like pie! - weebl.
Oneiric - Another graphics engine in the works.
Advertisement
thanks for the reply, it was fairly detailed instructions but I still couldn''t get my program to work. It didn''t have any compile errors, but it was having all kinds of trouble with the linker;

c:\010) temp\untitled1.o(.text+0x17):untitled1.cpp: undefined reference to `__glutInitWithExit''
c:\010) temp\untitled1.o(.text+0x37):untitled1.cpp: undefined reference to `__glutCreateWindowWithExit''
c:\010) temp\untitled1.o(.text+0x5f):untitled1.cpp: undefined reference to `__glutCreateMenuWithExit''
c:\010) temp\untitled1.o(.text+0x8d):untitled1.cpp: undefined reference to `_imp__glClear''
c:\010) temp\untitled1.o(.text+0x9d):untitled1.cpp: undefined reference to `_imp__glBegin''
c:\010) temp\untitled1.o(.text+0xc5):untitled1.cpp: undefined reference to `_imp__glVertex3f''
c:\010) temp\untitled1.o(.text+0xe3):untitled1.cpp: undefined reference to `_imp__glVertex3f''
c:\010) temp\untitled1.o(.text+0x101):untitled1.cpp: undefined reference to `_imp__glVertex3f''
c:\010) temp\untitled1.o(.text+0x10c):untitled1.cpp: undefined reference to `_imp__glEnd''
c:\010) temp\untitled1.o(.text+0x114):untitled1.cpp: undefined reference to `_imp__glFlush''
c:\010) temp\untitled1.o(.text+0x160):untitled1.cpp: undefined reference to `glutInitDisplayMode''
c:\010) temp\untitled1.o(.text+0x16f):untitled1.cpp: undefined reference to `glutInitWindowPosition''
c:\010) temp\untitled1.o(.text+0x184):untitled1.cpp: undefined reference to `glutInitWindowSize''
c:\010) temp\untitled1.o(.text+0x1a4):untitled1.cpp: undefined reference to `glutDisplayFunc''
c:\010) temp\untitled1.o(.text+0x1ac):untitled1.cpp: undefined reference to `glutMainLoop''

This is the program I tried to compile; (I am using DevC++ 4 with windows XP and GLUT-3.7.6)

#include <gl/glut.h>
#include

void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glFlush();
}

void main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
glutDisplayFunc(renderScene);
glutMainLoop();
}

I don''t know what went wrong, but I still can''t run my programs because of these linker errors.

The reason you are getting errors is because the linker can''t find the glut resource.

Make sure you have followed the above step-by-step. Particularly putting "-lopengl32 -lglu32 -lglut32" without the quotes into the Further object files or linker options box in Project->Project Options
I like pie! - weebl.
Oneiric - Another graphics engine in the works.

This topic is closed to new replies.

Advertisement