What API do 2D MacOSX games use?

Sage
Posts: 1,232
Joined: 2002.10
Post: #61
Quote:Originally posted by skyhawk
well at least fix your "bug" page so it looks like you know what you are doing, your bug page clearly shows that you are sticking a 512 pixel sprite into 513 pixels

Actually, no. The glOrtho clipping planes don't work like that. If you look around you'll see it's correct to use the full width/height:

OpenGL FAQ on opengl.org:
gluOrtho2D (0, windowWidth, 0, windowHeight);

Apple's BoingX:
glOrtho(0,[self bounds].size.width,0,[self bounds].size.height, 0.0f, 2000.0);

Apple's CGImage Loader:
gluOrtho2D(0.0f, size.width, 0.0, size.height);

Apple's GLChildWindowDemo:
glOrtho(0,bounds.size.width,0,bounds.size.height,-1,1);

Apple's Stencil Shadows:
gluOrtho2D(0.0f, size.width, size.height, 0.0f);

NeHe lesson #21:
glOrtho(0.0f,width,height,0.0f,-1.0f,1.0f);

etc.

I suggest that you turn filtering on in your code, and then see how well things line up for you.

Quote: and what is so advanced about this game that it requires such a high end mac? Shock

I consider a Radeon/GF2 as a bare minimum. NPOT textures are essential when you need a lot of arbitrarily shaped offscreen texture contexts.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #62
Quote:Originally posted by skyhawk
>>BTW, having 100's of rotating, scaling, transparent, animating sprites at way over 60 fps is really nice. You can't do that without OpenGL on the Mac as far as I know.

EV Nova does it, but they do dirty rectangles and that is a complicated procedure


EV Nova has hundred's of sprites on screen? As in OVER 200 sprites? That scale? I know it has some transparency and it also uses pre-rendered animations to simulate rotation... but that's not true rotation and the sprites don't scale at all.

EV Nova uses a modified version of SpriteWorld, which has since been updated to use OpenGL for hardware acceleration.

Obviously, the game is still great. Cool

I've never implemented dirty rectangles at a low level, but it's actually not TOO complicated. You just widen a rectangle to include any changed spots on the screen and update only that part in the buffer. (Or use multiple rectangles.) SpriteWorld does this for you "for free."

I like SpriteWorld but, Anders who did all the recent work with it has frustrating opinions about dealing with OS X. He doesn't like the fact that the API's are changing, and complains about buying new versions of the OS, but also doesn't consistantly support the FREE Project Builder, instead only making sure the expensive CodeWarrior projects work. BUT DON'T GET ME WRONG, he did incredible work on it, all for free. Grin

Anyway, SpriteWorld was great when I was using it, and Anders has passed the torch on to someone (Ken) JUST before it came out of beta. It's been a long wait and I moved on as it isn't currently cross platform. Sad

If you're interested in SpriteWorld check out the site. To find out the most recent info and where to get the latest version 3.0b2 check out the mailing list and just look at the archives.

Btw, let's keep it a bit more civil. No need to argue, just to figure this all out together. Wink

Aaron

P.S. I dig the icon with the Ultima dude from the Apple ][ version Cool

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #63
Quote:Originally posted by arekkusu
Actually, no. The glOrtho clipping planes don't work like that. If you look around you'll see it's correct to use the full width/height:

OpenGL FAQ on opengl.org:
gluOrtho2D (0, windowWidth, 0, windowHeight);

Apple's BoingX:
glOrtho(0,[self bounds].size.width,0,[self bounds].size.height, 0.0f, 2000.0);
etc. etc.

Just wanted to point out that you are using examples from Apple code that you said DOESN'T look correct anyway. So... they are poor examples of how it "should" be done. :ohmy:

I'm still curious if either of you have tried the other persons' tests.

I'd be doing all the testing myself except: My Project Builder code is building everything fine and then gives me a nice big green checkmark next to the phrase BUILD FAILED. I check the "tree" using the contextual menu and I get a failure to create an object or something... I could use a hint on where that's coming from, since I haven't changed the actual code at all. I'll do a more specific post about it if I can't figure it out, but if it sounds familiar I'd love to hear about it.

Aaron

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Tycho
Unregistered
 
Post: #64
Quote:I consider a Radeon/GF2 as a bare minimum. NPOT textures are essential when you need a lot of arbitrarily shaped offscreen texture contexts.


All I can say is that if you're going to release a 2D game with requirements as high as Doom 3, it had better be one hell of a good 2D game.Rasp
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #65
By the time I get my game done, you'll be able to pick up these video cards for $20. Wink

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #66
btw, a similar discussion just started up on the Apple OpenGL list

Quote:>> glViewport(0, 0, w, h);
>> glMatrixMode(GL_PROJECTION);
>> glLoadIdentity();
>> glOrtho(0, w, h, 0, -1, 1);
>
> You probably want that to be (0, w-1, h-1, 0, -1, 1). It takes
> left/right, ..., not left/width.

No, the original version is correct. OpenGL's coordinate system just
just like the lines on graph paper, with pixel centers in the middle of
the squares. So if you were to draw a box surrounding the same number
of pixels as your window size, you can see that you'd want 0,w,h,0 in
his case.

Aaron

P.S. Am I allowed to do that? I'll have to check the list guidelines again. :ohmy:
P.P.S. It's customary to give a link to the lists where it came from:Apple Lists

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #67
Quote:Originally posted by Tycho
All I can say is that if you're going to release a 2D game with requirements as high as Doom 3, it had better be one hell of a good 2D game.Rasp

Well, Doom 3, and I predict more and more 3D games after that, will be requiring vertex and pixel shaders to get the best visuals. That means Geforce 3 or Radeon 8500 or newer. And really, Geforce FX or Radeon 9700 for the real floating point pixel shaders.

A Radeon or Geforce 2 is already quite a low minimum requirement. Apple has the same requirements for Quartz Extreme, I don't think it's too much to ask for. Sorry if you feel otherwise.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #68
it really ISN'T too much to ask for, but never whine about getting a smaller slice of an already small slice of pie.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #69
Guys, I posted a new thread asking a related question. I'm interested in your answer. Please, check it out here.
Thanks! Smile

P.S. I'm compiling again after a devTools and SDL reinstall... so maybe I'll have something a little more concrete to contribute now.

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #70
So...

Just using gluOrtho2D... well, that was an answer to the "big" blurry question. In other words, since the imagery matches the resolution, it shouldn't be scaled and aliased. That answered Carl's larger question, but there is another.

The more difficult problem is the slight pixel shifting that gives a soft look near the bottom right hand side of the screen.

Skyhawk's proposed solution:
gluOrtho2D(0,width-1,0,height-1);
In my program, I tried subtracting 1 from my width and height values (starting at 0) and it made the effect even worse.

Why does it work for his program? Well, I tried what arekkusu suggested in my program, (after removing my hack) and, indeed, turning on GL_Nearest filtering fixed everything. Except, that scaling or rotating would look awful! Smile I'm assuming that, if Skyhawk turned on GL_Linear filtering in his program, he'd see the same ugliness in the corner of his window.

So, where does that leave us? It leaves us waiting for a bug fix. In the mean time, I'm using my old hack, which, as said before, works:
[SOURCECODE] if (destX > 300)
{
glTranslatef(0.05, 0.0, 0.0);
}

if (destY > 200)
{
glTranslatef(0.0,-0.05, 0.0);
}[/SOURCECODE]

The only problem with this, is that if Apple fixes the bug, the hack may CAUSE the effect it's supposed to fix... but I'm guessing it won't, since the offset is so small.

Aaron
P.S. sorry for the duplicate posts that were here!Blush

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #71
Quote:Originally posted by aaronsullivan
So...
The more difficult problem is the slight pixel shifting that gives a soft look near the bottom right hand side of the screen.

This problem is very slight. It is most obvious when you use high-contrast images, and one large quad. It also has slightly different behavior between 2D and rectangle textures, and between ATI and nvidia hardware.

As you point out, turning off filtering is one way to reduce (but not completely eliminate) the problem. But you might require filtering to be on depending what you're doing.

Geoff Stahl at Apple recently implied an upcoming fix for this problem, so my advice is to just ignore it for now. Any tweaks you make could well break on future systems.

Here's the (somewhat oddly worded) comment from him, re: RADAR 3144695:

Quote:This bug is now in verify to be fixed in a future OS release/update. I just verified the bug fixed the other day myself. Obviously I can't comment on where/how this fix will be released.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #72
Thanks to someone trying to put SpriteWorld on top of SDL, SpriteWorld may become a crossplatform library. That's pretty cool.

If you're interested, you can read about it here:
http://www.pairlist.net/pipermail/swml/2....html#2058

Also, the main site is:
http://www.spriteworld.org

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #73
Oops, I didn't see these other comments...

Quote:Originally posted by aaronsullivan
etc. etc.
Just wanted to point out that you are using examples from Apple code that you said DOESN'T look correct anyway. So... they are poor examples of how it "should" be done. :ohmy:

I'm still curious if either of you have tried the other persons' tests.

That's true, the "correct" way to do it doesn't work. But that doesn't make an incorrect way any better. Wink

I've tried many many incorrect ways. It's really a bug in GL. Hopefully fixed in 10.2.7, if not, 10.3.

Quote:P.S. I dig the icon with the Ultima dude from the Apple ][ version Cool

Thanks. That's from Untima 9.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #74
Honestly, I'm just glad to know what was going on. I fixed it, but I was never satisfied with it. Mad

All is Cool now.

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Post Reply