LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2004, 12:05 AM   #1
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Rep: Reputation: 15
OpenGL exit problem - screen corruption


Hi all, I'm currently doing some programming involving OpenGL in C++. My question is this, whenever I run the program at the same resolution as the desktop and in fullscreen the screen usually gets corrupted on program exit. The program exit is not abnormal hence I have no clues on which I can track down the problem. When I swap the screen (CTRL+ALT+F6) and swap back (ATL+F7) the screen returns to normal. And this ONLY happens when the program runs fullscreen at the same resolution as the desktop. Any ideas? Thanks!
 
Old 07-07-2004, 12:22 PM   #2
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
Corrupt? What do you mean? Please explain how it goes currupt a little better.

Maybe you are not properly shutting down what ever you are using to open the Window (glut, SDL, X11).
 
Old 07-07-2004, 10:57 PM   #3
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Original Poster
Rep: Reputation: 15
well, basically the whole screen gets "distorted" with the previous screen image. Everything gets "stretched" horizontally and stays that way. No movement whatsoever. However, when you move the mouse ard, the icon changes appropriately to what is on the desktop (ie. chgs to writing cursor in a text editor - stuff like that). That's basically the best way I can think of describing the corrupted screen.
 
Old 07-08-2004, 03:30 AM   #4
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
Now I don't know anything about programming, but just listening to that tale, the logical place to start troubleshooting would seem to be that something in your code is not completely restoring the desktop as it is supposed to. The mouse cursor is clearly released (since it does properly respond to desktop icons and the like), but something like Xrandr (as a random example of items that might affect this-- as I said, I don't know anything about it) isn't.

The next thing I notice is that you say this only happens when your program is running at "the same resolution as the desktop". This would seem to imply "conscious" behaviour (that the program knows that it, as well as the desktop, are running at 1280x1024, for example), but what if it was a fluke? Is it possible that your program is not accurately recording the original dimensions of the desktop, and the only one who knows that they are both running at "the same resolution" is in fact you? If you change your desktop to run at 640x480 (rather than whatever you run the desktop in normally) or 800x600, and then run the program at the same resolution as the desktop, does the problem still occur? If not, then at least you know it's a problem with the particular resolution rather than the program as a whole. Plus, are you running at a "non-standard" resolution (like on a laptop display, for instance)? That could conceivably also be a problem.

Lastly, I would suggest that you try to look at the code for an Open Source, full-screen, OpenGL game that does restore the desktop properly, and see how it does it. That might help you identify what you're doing (or not doing) properly.

Just some ideas from a non-coder; hope they're helpful in some way.
 
Old 07-08-2004, 01:23 PM   #5
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
What library are you using? SDL? If SDL (and maybe other libraries), then if you have your resolution set to 650x470, SDL will actually set the video mode to 800x600 and make a little window centered inside the screen that is 650x470. If this is the case then you could have acidentally have your resolution off by one and you could actually have a different video mode then your desktop. Your problem is that you are not restoring the video mode properly. To help I will need to know HOW you are setting the video mode in the first place. I still might not be able to help though. So you should probably look up the video mode functions for what ever library you are using.

You could actually even have set the same video mode as your desktop and get this anommily if you don't restore the proper video mode.

Basicly, it's bad not to restore the video mode to what it previously was.
 
Old 07-08-2004, 08:02 PM   #6
deveraux83
Member
 
Registered: Jul 2003
Location: Malaysia
Distribution: Red Hat, Slackware 9.1
Posts: 76

Original Poster
Rep: Reputation: 15
First off, it ONLY happens when desktop resolution = fullscreen resolution. I have tested this theory at both 1280x1024 and 1024x768. Secondly, to answer The_Nerd, I am not using SDL, was thinking of but I kept on getting the problem where it seems that I get no video acceleration and when memory is initialised, it says that I am using system RAM, not video RAM hence I stopped using it for a while until I figure out the problem. The window is being set up by glX in gnome 2.6 (if that helps) but I also noticed the same problem in gnome 2.4 (haven't tried it on any other versions of gnome yet). The code is obtained from NeHe's tutorials ported to linux in glX form. I usually run my desktop @ 1280x1024 and the program @ 1024x768 but since I'm not at uni right now (where I left my monitor), I'm using my home monitor which can run only 1024x768 with > 60 Hz refresh rates.

Also, I made my code in such a way that if ever any resize occurs, it will display to the screen the new resolution (even if set my OS) and as far as I can tell, no such resizes have occured.
 
Old 07-10-2004, 12:59 AM   #7
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
Look up glX video mode functions on google and I am sure you will find what you need.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I exit a full screen Tsclinet session? fabre Linux - Software 2 03-15-2006 06:09 AM
Blank Screen After Install (How To Exit X) JyushinX Mandriva 1 03-14-2005 05:04 AM
Corruption at the top of screen after shutting and opening laptop lid TMH Linux - Hardware 1 01-18-2005 02:08 AM
Screen corruption with telnet, ssh subu_s Programming 0 01-17-2005 11:55 PM
help!!!! how to exit full screen mode in xine littlecap Linux - Software 7 03-10-2003 07:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration