View Full Version : Exclusive Ressureces like in DirectX?
05-30-2002, 07:15 AM
I have currently started developing a game and I have to decide whether to use OpenGL or Direct3D.
So far I have not found a possibility to gain exclusive access to the screen in OpenGL like it is possible in DirectX. The 'glutEnterGameMode()' function seems to change only the resolution etc. but still handle the application in a cooperative level with the others but not in exclusive mode.
Does anyone know how to implement this (preferably without mixing OpenGL and DirectX)?
Thanks in advance!
05-30-2002, 11:51 PM
Under OpenGL you can not get exclusive access to the display video memory (it's not a toolkit problem, it's the OpenGL design). However, you very seldom need direct access.
What do you need to accomplish? If you need to read back pixels in order to do decisions (e.g. visibility tests or something else), there are other methods (e.g. glReadPixels). If you need to write 2D images to (a part of) the screen the best way is usually to upload the image as a texture and render a single textured quad on the screen (that way you do not stall the rendering pipeline, which usually gives much better performance than glWritePixels). If you need to use a part of the screen as a texture, you can use glCopyTexture2D, or the pbuffer + render to texture extension(s).
The only situation when you would need to access the video memory directly is when you need to apply some complicated software algorithm to modify the pixels on the screen (do you really need that?!). Under OpenGL you would then have to do a combination of glReadPixels, modify, glWritePixels, which is dead slow.
PS. For game development, you may want to check out GLFW (http://hem.passagen.se/opengl/glfw) and CPW (http://www.mathies.com/cpw/) as alternatives to GLUT.
[This message has been edited by marcus256 (edited 05-31-2002).]
05-31-2002, 08:05 AM
Thanks for your advice.
I donīt need to access the video memory directly. I was only looking for a way to get exclusive access to all user interface devices (screen, keyboard, mouse, etc.) in order to prevent the game from being interrupted by other programms and to disable all system keys except Ctrl+Alt+Del or Ctrl+Alt+Backspace, respectively, because it is not nice if you get the taskbar or other applications in the wrong resolution by pressing the Win-Key or Alt+Tab.
But this problem seems to be solved in GLFW since the resolution is restored again.
06-01-2002, 11:03 PM
Yes, GLFW tries its best in handling those situations (every new release does it a little better than the previous one http://www.opengl.org/discussion_boards/ubb/wink.gif ). There is also the option to disable system keys:
glfwDisable( GLFW_SYSTEM_KEYS );
I think CPW has similar functionality.
IMHO it's a good thing if an app can live with application switching (ALT+TAB), e.g. by entering paused mode whenever the window goes inactive or iconified. This way ppl do not have to shut down the app if they need to check mail or whatever.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.