OpenGL and GLUT in Fedora 12: windows too small and don't resize
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OpenGL and GLUT in Fedora 12: windows too small and don't resize
I have verified using yum that I have the most uptodate glut, freeglut, freeglut-devel etc., yet when I compile Example 2-6 from the Red Book at http://www.glprogramming.com/red/chapter02.html#name16, I get a window that is too small for the program output, includes display from other windows, and will not redraw after being resized.
I get slightly better behavior with the SGI sample program mentioned in the same book, 'checkers.c'. Again, the initial size is too small, but at least it will resize and redraw the checkerboards entirely inside the resized window.
What is going on here? Is this some bug in glut? I can't see anything obviously wrong in their glut initialization, which looks like:
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (350, 150);
// glutInitWindowSize (700, 300); // did not help
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
Then again, since I am such a newbie to glut, I am not sure I would recognize what, if anything, they did wrong.
But I have a simpler question: what ARE the valid and useful command line parameters I could have passed to the main() above?
At first glance, I thought this was unconditionally worse, since nothing shows up after resizing using the mouse. But after switching windows back to this browser window and then back yet again o the program output, I see the upper inch or so of the desired output -- clipped at the very bottom of the Fedora (GTK?) window!
So the placement in the output window is still very wrong, but once it is forced to redraw after losing focus, the portion that gets rendered gets rendered correctly.
Does this tell you anything?
BTW: I have both Gnome and KDE loaded on this thing. How do I tell which windowing system it is using? Could this be what is confusing GLUT?
This also looks good. I still have all my code from going through that same guide. I compared both your main and reshape functions to my own, and they are the same. So the code is probably not the problem.(note: i used Mac OSX)
Quote:
I have both Gnome and KDE loaded on this thing. How do I tell which windowing system it is using? Could this be what is confusing GLUT?
If your current desktop isnt showing correctly, try the other. so if you are currently using Gnome for the desktop, switch to KDE and see if you get better results. Or you might also try running it from command line, I think it only requires x11 (though not sure about this).
This also looks good. I still have all my code from going through that same guide. I compared both your main and reshape functions to my own, and they are the same. So the code is probably not the problem.(note: i used Mac OSX)
If your current desktop isnt showing correctly, try the other. so if you are currently using Gnome for the desktop, switch to KDE and see if you get better results. Or you might also try running it from command line, I think it only requires x11 (though not sure about this).
Since I only installed KDE-base to run Konqueror and Krita, I am not even sure how this is done
Then again, it may not even be relevant after all, since in fact, I have always invoked the OpenGL sample programs from the command line, usually Gnome's Terminal, very rarely KDE's Konsole, which, however, gave the identical results.
So, for example, I named devnull10's code 'Ex9.c', compiled with "gcc -o Ex9 -lglut Ex9.c" and ran with "./Ex9" to see much better results.
Cool! It painted a white square in the middle, and showed an orbiting polyhedral approximation to a sphere.
Since it was right in the middle, and did not require any switching in/out of focus, I assume it worked flawlessly.
So what does this tell us?
Then again, now that I actually paused to read the code, I see that no, it is not working flawlessly: the only sphere drawn is white, not green, though the code should have drawn a green sphere with:
Well, it tells us that your system can render OpenGL applications properly and the reason that your application isn't doing is likely an issue with your matrices, projection coordinates, or something similar, rather than an actual system error.
[edit]
Just seen your post about the colours - not too sure about that - I'll take a look later, just in the middle of something now!
Well, it tells us that your system can render OpenGL applications properly and the reason that your application isn't doing is likely an issue with your matrices, projection coordinates, or something similar, rather than an actual system error.
[edit]
Just seen your post about the colours - not too sure about that - I'll take a look later, just in the middle of something now!
Any ideas about the colors? Could this be a bug in the OpenGL libraries I am using? Do I need lighting commands to be a workaround for a bug?
I can't remember how to view what version of OpenGl and GLUT I have, but I do remember installing the most up-to-date available as packages for Fedora; I did the install within the last three weeks.
Try this - rename the attachment to ex4.tar and then extract. I think the example I provided might have been a poor one - it was just one I pulled from my old uni archive!
This is one I wrote when at uni.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.