View Full Version : linux opengl newbie shelling
04-29-2004, 05:06 AM
ok, just so you know im new to linux. just poped it on my rig about 3 weeks ago. i know how to program in c++ for windows. well, the other day i thought i would try to learn how to use opengl. So i started looking through the NeHe lessons and tried to do #1. well after a long time i got everything i needed to install like XFree86-devel libs and stuff like that. and then i figured out how to use gcc(this is my first opengl program and my first linux one too). So i got lesson1.c compiled. Well, now i'm confused on how to run it. It is a binary file(i mean it was compiled and all and the mine type is binary) so i tried to 'sh' it but it says:
lesson1: lesson1: cannot execute binary file
so i dont really understand how to run it. and i know opengl works on my computer becuase i can run other opengl apps like ut2k4.
04-29-2004, 05:18 AM
when you call gcc to compile a source file, like "gcc helloworld.c", it produces an outpout file called "a.out" which you can run directly. just by typing "a.out<enter>" or, on some linux versions, "./a.out<enter>".
How exactly did you compile it? Like this maybe:
gcc -c lesson1.c
If that's the case then the resulting lesson1.o file is just object code, which means it has to be linked with various libraries etc. to become executable code. Make sure you download the linux code of lesson1 and then just type make to build it. Of course you should also learn how to link using gcc and how to write simple makefiles in order to be able to build your own code as well. Also, you can always try an IDE if you find that easier.
04-29-2004, 07:58 AM
however when i run it i get the error:
GLUT: Fatal Error in lesson1: visual with necessary capabilities not found.
i guess i have some more work to do. :)
04-29-2004, 08:38 AM
Looks like your opengl environment is not setup in X.
You will now have to walk down the path of geting OpenGL working with X.
You will have to do different things depending on which graphics card you have.
With NVidia, you need to got to the nvidia website and download their driver and install it. You will also have to edit your X configuration file, in redhat/fedora, it lives in /etc/X11/XF86Config or XF86Config-4.
There are some readme's and example configuration files in /usr/share/doc/NVIDIA -- or something like that...
For newer ATI cards you will need to download their drivers. I have yet to install their dirvers, so I can't help you there. Older ATI cards have opensource drivers, and you should be able to set them up from within one of you settings applications on your desktop.
04-30-2004, 04:14 PM
I think this is not a general opengl setup problem, if the program went so far, opengl seems to be working. the problem rather seems to be that the desired pixel format is not available. for example, if the opengl application needs a 32 bit framebuffer and your x setups is only 16 bit framebuffer, the program won't run. So check your XF86Config setup if it suits your opengl needs.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.