🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGL and Linux

Started by
13 comments, last by Null and Void 23 years, 3 months ago
Well, now that I have linux set up, I have more questions to pester you with . I decided to use KDevelope since I''m still phasing myself out of MSVC. I downloaded the OpenGL/GLX Linux source code for Lesson 1 from Nehe''s site, and setup a custom project. I added the C file and the makefile to the project, and then compiled it (successfully). Now, when I first ran it I was greeted by a black window. This is suppossed to happen I figure since there is nothing being rendered. But, when I hit ESC to close the program it didn''t respond. So, I hit ctrl-alt-backspace to drop myself out of KDE, and I relogin and try it again, same thing happens. Ok, I figure there is something wrong with Linux''s interaction with my video card (TNT2 32MB). So, I log into root, and then I go to nVidia.com and download the newest linux RPM drivers for Redhat 7.0 386. I go to the directory I downloaded them into (in console, BASH) and type rpm -ihv *.rpm and they install them. So, they say they installed successfully. And I figure that the program should work now. So, I boot back out to my login, and try the program again, but nothing happens. So I open the console and type . lesson01 and it says that the executable file cannot be run. So, I recompile it to make sure I didn''t screw something up, and the same thing happens. Anyway, I decided to ask what I''m doing wrong. Is it a compilation problem (my fault), a driver problem (partially my fault), or what ? Can anyone give me a hint what to do in other words, I''m sure you''ve all had to get OpenGL working in Linux before, so you''re more experienced with this type of thing that I am. Thanks in advance. "Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
Advertisement
Probably a linker problem(might have broken gl libs). I have heard nvidia drivers overwrite the mesa files(I suppose libGl.so and lubGlu.so, not sure which ones). I suggest you checkup with mesa files.

Secondly I hope you are running it in an xterm and not CUI mode, else it will either seg fault or crash.

And I don''t think there''s is much problem with Riva TNT cards with XFree4.0 or above.
Hello from my world
quote:
Secondly I hope you are running it in an xterm and not CUI mode, else it will either seg fault or crash.

Probably just ignorance on my part, but I have no idea what you meant by that .

The nVidia lib''s do rename the Mesa ones, and then replace them. So, they''re still there as something or other. I''ll look into the linking problem, it didn''t look like it was even using the lib''s (I expected it to have an linked error, but it didn''t for some reason).

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
Are you saying that Kdevelop went into a black screen or
your application rendered a black window?

If it is your application, then the probable cause for
not responding to the escape key is either that you
didn''t use a keyboard event handler (ie using glut) or
you are not watching for KeyPress events (using glX).
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
I am watching for keypress events using GLX. I changed the code so that it would quit if any key was pressed and it still wouldn''t work. I think it was dying right after it ran, instead of working correctly.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
GLX is a driver, I think you mean glX.

But glX does no event reporting, it''s the `glue'' between
OpenGL and Xlib. You''d want to do your event fetching
with Xlib calls, see XNextEvent() and XPending() for example
of fetching events.

Check the event->type to see if it is a KeyPress event.
You''ll need to use keysym conversion if you want to
find out what keycode the event has. The XKeyEvent
reports keycodes, you need to convert those into a keysym
name and match up that name in a lookup table.

If you need help on that let me know.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
Well, it''s the glX (fine, I''ll correct my caps ) code from Nehe''s, just to see if had my IDE and Linux set up corrently. It uses something for keyboard i/o, for all I know it is using XLib .

If you look at the glX code here, it is the same code that I am using for testing. I wish I could get it to work, but I figured I just work more on my Windows version of the engine until I found a guide to making it all work, heh (or, in this case, some on gamedev.net tells me that I did something stupid and how to fix it ).

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
A few pointers...

If you can get to a console, then don''t ctrl-alt-backspace out of X to kill your program. First find the PID of your program (try "ps aux | grep myprogram" to find that), and then do a "kill PID", which politely asks your program to shut down. If your program doesn''t know how to respond to that, then do a "kill -9 PID", which tells the kernel to kill the process, and the kernel ain''t polite about it. kill -9 should kill ANYTHING. Alternately, you may have a utility called "killall" which doesn''t need a PID, it just needs the name of the program, which makes life easier. On the downside, if you''re running multiple instances of your program, it''ll kill them all.

If you were really having driver problems, you''d probably get an error message saying so, but who knows. Just in case, look for a script called, "nv_check.sh", which i think i found at Loki Software''s guide to setting up NVidia 3D. It makes sure everything''s set up properly, and is really helpful.

Finally, i''d get a copy of a 3D program that i know should work, and see if it''ll run on your system. If it does, then it''s just something in your code.

Good luck,
-ben.c
Ok, I booted into Linux (still in it now) to try out that nv_check script. I downloaded it, and when I finally got it to let me run it (I had to redirect output to a file, since it ends too quickly for me to read it), it did identify installation errors.

I fixed the error about loading "nv" instead of "nvidia", but now I have one that I understand kind of, I just don''t know how to do it correctly. Here''s the text:
quote:
All the files seem to exist. Now I''m going to see if you kernal module is loading correctly...
the NVdriver kernal module does not seem to be loaded. The 3D drivers will not work without it...please compile it for your kernal, set it up to insert the module on boot, then run this script again.
Remember if you are having troubles compiling the module, try adding -D_LOOSE_KERNAL_NAMES to the Makefile.


I don''t want to screw this up, so I''m hoping for some direction. I have root access, and all of that, so don''t worry about that .

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
Seems to me like you either need to recompile your nvidia drivers or if the nvidia drivers patched up the module into your kernel you need a recompile of your kernel.

Hello from my world

This topic is closed to new replies.

Advertisement