Advertisement

Mandrake and opengl

Started by November 27, 2004 08:40 AM
8 comments, last by seanw 20 years ago
Ok after alot of work last night to setup partition and install mandrake i finally have it running but..... I'm trying to do opengl programming for a class. The problem is they never taught us how to set it all up so we could do it at home. So i have been working on the university computer where everything is nicely setup and we are provided make files and everything. The problem is i need to do a project and need to work on it at home. So.... i need to know how to install glut/mesa/whatever else i need so i can work on this stuff at home. I need help urgently as i only have about a week left so if anyone out there can explain it to me very very simply what i need to do it would be much apperciated. P.S. How do you make yourself root outside of the console so you can move files around i.e. into /usr(it won't let me)? P.P.S. here is a small example of the code stuff i need to run #include <GL/glut.h> #include "render.h" #include "objects.h" static GLfloat white_colour[] = { 1.0, 1.0, 1.0 }; static GLfloat red_colour[] = { 1.0, 0.0, 0.0 }; static GLfloat filter_colour[] = { 1.0, 0.78, .25}; void Cigarette() { glPushMatrix(); setColour(white_colour); glTranslatef(0,4,0); glScalef(.5,4,.5); drawCylinder(20); glPopMatrix(); glPushMatrix(); setColour(filter_colour); glTranslatef(0,1,0); glScalef(.5,2,.5); drawCylinder(20); glPopMatrix(); glPushMatrix(); setColour(red_colour); glTranslatef(0,6.005,0); glScalef(.5,.01,.5); drawCylinder(20); glPopMatrix(); } void Render() { Cigarette(); } And an example of the make file we were given(no idea what this stuff does so if you could tell me what i need to change here) TARGET = lab06b DEBUG = -g CFLAGS = ${DEBUG} OBJS = main.o Ball.o BallAux.o BallMath.o render.o objects.o texture.o # WHERE TO FIND CERTAIN HEADERS AND LIBS # Linux DIR_HEADERS = -I/usr/local/Mesa-6.1/include LINK_LIBRARIES = -L /usr/X11R6/lib -L/usr/local/Mesa-6.1/lib -lglut -lXmu -lGLU -lGL -lX11 -lm #Linux compile linux: ${OBJS} $(CC) -o ${TARGET} $(CFLAGS) $(DIR_HEADERS) ${OBJS} ${LINK_LIBRARIES} clean: - rm core render.o main.o ${TARGET} #SUFFIX RULES: any file with one of these suffixes is significant .SUFFIXES: .o .c # SUFFIX RULE: how to turn a .c file into a .o file .c.o: $(CC) -c $(CFLAGS) ${DIR_HEADERS} $*.c -o $*.o
Mandrake is RPM based, so all you really need to do is search around for RPMs of Mesa and Glut. The first place to look would be on the Mandrake install CDs, as those usually come loaded with just about everything. If that's a no-go, google for Mesa RPM and you'll get all sorts of hits.

Alternatively, if you have accelerated video hardware, the hardware manufacturer may provide accelerated OpenGL drivers at their website. This would be the best way, really, to ensure that you get hardware acceleration rather than software (slow) emulation. I use NVidia, and their driver packages come with the GL libs and the header files needed to access extensions without going through the GLX extension querying mechanism.

As far as hacking your Makefile, look for the lines that are structured -I/some/path and -L/some/path. These are directives to the compiler and linker telling them where to find certain files. In the case of -I, it tells the compiler where to find include headers, and -L tells the linker where to find libraries. You can add additional -I and -L directives to these lines to specify the exact locations on your machine where the various GL and Glut header and libraries are installed. That should be the only thing you'd need to modify.

And finally, exactly what do you mean make yourself root outside of console? You can logout as user and log back in as root, which will give you a root-owned desktop shell. Or you can open a console, su to root, then as root execute an instance of Konqueror or whatever graphical file manager you prefer to use (or have available) for moving files around. Or just su to root and use command-line tools to copy files into /usr. (Of course, I probably don't have to tell you to be careful as root. Otherwise, you may end up like this guy. [evil]
Advertisement
I used tarballs unzipped and in the case of mesa did make -linux86(or something similiar). I think i have everything in the right place now(or rather i hope i been setting this stuff up or trying for the last 6 hours). I had to transfer file from my home directory in usr/local via root in console(this is what i mean by not being able to access root files i am in my home directory and no usr/bin/..... type directories seem to be aplicable to me). Now when i try to run it it seems the the libraries are loading but then i get this error "/usr/bin/ld cannot find -lglut
collect 2 ld returned 1 exit status" i assume this is a problem with the make file. Also if i try to run a file that has prevoiusly been made i.e. in college it runs fine but if i change anything and try to make errors come up.


P.S. Plan was to work on project all weekend get it all done so i can worry about study and other stuff. Since friday 4:00pm i've managed to partition drive(had lots of problems with this) install linux and install nvidia driver thats pretty much it its now 11:42 pm saturday...........its so very frustrating *sigh*
did you install the glut RPM?
I found no rpm for glut and mandrake 10. I did extract a tarball but unsure where to put stuff and/or if i need to do another make thing like with mesa. Online instruction are generally not very clear(or at least not to me).
Ok each time i try to run the make file i get a series of warning "APIENTRY" redifined and warning this is the location of a previous definition messages. I have no idea whats causing these. Also after that i get the /usr/bin/ld cannot find -lglut collect 2 ld returned 1 exit status and it exits out. why is it looking in usr/bin ??

Advertisement
It's not looking in /usr/bin; that's where ld is located. ld, of course, being the linker.

The APIENTRY redefinition problem is caused by the symbol APIENTRY being #defined more than once. APIENTRY is commonly defined to simplify some declarations necessary for constructing Win32 DLLs, so typically it will be wrapped in sets of conditionals to define it one way for Win32, and define it another for everything else. Look to make sure all of the conditionals are intact and have not been modified, because it appears as if a conditional has been fudged somewhere and it is trying to #define it twice.

And the error that it can not find -lglut simply means that it can not find the glut library. Check to make sure you specified the name of the library correctly on the linker settings. Also, make sure you have correctly specified the -L/path/to/glut/library directive correctly in the linker settings so it knows where to find it.
Ok was able to get rid of api reference stuff and -lglut problem but now i am getting these type of errors:

first i get undefined reference to render(this is setup in render header file which is included)
and then
/usr/local/mesa-6.1/lib/libglut.so undefined reference XGetExtensionVersion
/usr/local/mesa-6.1/lib/libglut.so undefined reference XFreeDeviceList
/usr/local/mesa-6.1/lib/libglut.so undefined reference XQueryDeviceState.....etc

You have been very helpful so far and hopefully i will soon have it all working so thanks

I think it may have something to do with nividia drivers i couldn't find any answers online though.

P.S. I lived in Arizona for 8 years :)

[Edited by - Conor_BloodMoon on November 28, 2004 2:47:33 PM]
Nevermind i finally got it working all i needed to do was put
-lXi in the make file so it finally all works (at least for the moment anyway) now all i have to do is a whole project...........d'oh

P.S. thanks for the help
Quote: Original post by VertexNormal
Mandrake is RPM based, so all you really need to do is search around for RPMs of Mesa and Glut. The first place to look would be on the Mandrake install CDs, as those usually come loaded with just about everything. If that's a no-go, google for Mesa RPM and you'll get all sorts of hits.


Mandrake does use RPMs, but it has URPMI built on top of it for apt-get style functionality. Searching for random RPM files on google isn't a great idea when you can just use Mandrake URPMI sources (try looking on http://easyurpmi.zarb.org/) so when you install the RPM you want, URPMI will automatically resolve the dependencies it needs to work.



Goto to the Mandrake control center then click Software->Add Software then search for OpenGL in the package names for your current URPMI sources, click the ones you want and click install. Your CDs should have the Mesa libraries you need for glut. Alternatively, just type "su; urpmi mesa" into your console. That's all you have to do.

This topic is closed to new replies.

Advertisement