CoreGraphics question

Moderator
Posts: 508
Joined: 2002.09
Post: #1
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.

"When you dream, there are no rules..."
Quote this message in a reply
nabobnick
Unregistered
 
Post: #2
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.
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #3
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/utopiaplanet...Struct.dmg , but it uses Carbon instead of Cocoa.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #4
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.

"When you dream, there are no rules..."
Quote this message in a reply
nabobnick
Unregistered
 
Post: #5
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.
Quote this message in a reply
Post Reply