View Full Version : CoreGraphics question
Taxxodium
2004.09.24, 06:18 PM
According to the technote about CGDisplay, when you switch to a different screen resolution you need to capture the screen first, switch modes, do your drawing and when done switch back and release the screen.
Now, I noticed that when the screen is captured you can't draw to an NSView (I'm writing a Cocoa game). So what's the use of capturing the screen if you can't draw or am I missing something?
I also noticed that Apple talk about getting the base address of the display, what's up with that?
Any info is greatly appreciated.
nabobnick
2004.09.24, 06:58 PM
There is a function to get the base address but I do not remember it off the top of my head, it is listed in the CoreGraphics reference documentation.
There is also an option to put up a shielding window and draw to that, you have to call the windows setLevel (if I remember correctly) to the value returned by another CoreGraphics function that gives you the level of the shielding window.
Sorry for the somewhat vague details, but it has been a while since I've worked with it. Also to save you some possible trouble if you are thinking of using this in a game you will get abysmal performance, start learning OpenGL unless you are designing a board game or maybe something simple like Tetris you will get very low frame rates otherwise.
FCCovett
2004.09.24, 07:04 PM
With CoreGraphics, it's recommended that you create a new window on top of the shielding window and then bring it to the front. There's an example on how to do that in my source code at http://webpages.charter.net/utopiaplanetia/BasicCarbonStruct.dmg , but it uses Carbon instead of Cocoa.
Taxxodium
2004.09.24, 07:29 PM
Well I started learning OpenGL but the texture mapping stuff scared me a bit. I would like to use an NSImage for the textures.
I know the function to get the base address, but I don't know what to do with it.
The game I'm making is an action game so performance should be good.
nabobnick
2004.09.24, 08:49 PM
It would probably be best to create the shielding window then. If you don't you have to draw two different ways, one for windowed mode and one for full screen mode. If you have a shielding window I think you can still use the code you use with NSImage.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.