Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Not if you're not refining the parameter or return types and want callers to use your more accurate signature.

Adbot
ADBOT LOVES YOU

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!

rjmccall posted:

Not if you're not refining the parameter or return types and want callers to use your more accurate signature.

Oh SNAP you can do that in Obj-C?

So, all of these are valid?
code:
@interface SomeClass { }
@end

@interface SomeSubClass : SomeClass { }
@end

@interface Super { }

-(SomeClass*) methodOne:  (SomeClass*)firstParam;
-(SomeClass*) methodTwo:  (SomeClass*)firstParam;
-(SomeClass*) methodThree:(SomeClass*)firstParam;
-(SomeClass*) methodFour: (someClass*)firstParam;

@end

@interface Sub : Super { }

-(SomeClass   *) methodOne:  (SomeClass   *)firstParam;
-(SomeClass   *) methodTwo:  (SomeSubclass*)firstParam;
-(SomeSubclass*) methodThree:(SomeClass   *)firstParam;
-(SomeSubclass*) methodFour: (SomeSubclass*)firstParam;

@

@implementation Sub

-(SomeClass   *) methodOne:  (SomeClass   *)firstParam { return [super methodOne:  firstParam;] }
-(SomeClass   *) methodTwo:  (SomeSubclass*)firstParam { return [super methodTwo:  firstParam;] }
-(SomeSubclass*) methodThree:(SomeClass   *)firstParam { return [super methodThree:firstParam]; }
-(SomeSubclass*) methodFour: (SomeSubclass*)firstParam { return [super methodFour: firstParam]; }

@end
Actually I don't think I like the parameter version, but it'd be cool if I could do this instead:

code:
@implementation Sub

-(SomeSubclass*) balls:(SomeSUPERClass*)firstParam {
  return [super balls:makeSomeClassFromSuper(firstParam)];
}

@end

samiamwork
Dec 23, 2006
So I'm an idiot and created an app in iTunes Connect with the wrong App ID. I deleted it before I submitted anything but still it looks like the app name is gone forever. Is this really true? I've got an email out to the only iTunes Connect info I could find but maybe someone here has info. This seems really stupid.

Also, "Contact Us"?! Wow. They might as well just call that page "Do Not Contact Us".

I really hope I don't have to pick a new name. But I probably will, rather than wait forever for a response.

Edit: reading the dev forums it looks like *other* people can use my name but *I* can't? How does that make sense?

samiamwork fucked around with this message at 05:13 on May 15, 2011

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

wellwhoopdedooo posted:

Oh SNAP you can do that in Obj-C?

Yep. Not only you can do the nice covariant-return and contravariant-parameter cases, but you can also do:

code:
@interface SuperClass
- (int) foo: (void*) p;
@end

@interface SubClass : SuperClass
- (float) foo: (NSRect) r;
@end
And you'll just get crazy crashes when calling through the wrong method signature. So, you know, use your newfound knowledge wisely.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Major Thom posted:

I've been agonizing over whether to get a 21.5" iMac or a 27" iMac. The hardware isn't the stumbling block - it's the screen resolution.

In short, the 27" has enough vertical resolution for me to easily work on full-size retina mockups in PS. I've always developed and designed on a 15" MBP, and that kind of extra space seems like it could be a game changer.

So I guess my question, to those of you who currently use the 27", is this: would it be agonizing to have to do your work on the 21.5"?

I understand that it's a matter of taste. But still.

I can tell you having a 1920x1200 MBP makes doing iPad screens a much better experience since the whole thing fits onscreen at one time (with no scaling). The same applies to retina screens since they are almost the same size (why iPhone4-enabled apps don't run in retina resolution on the iPad baffles me... it would be a much nicer experience).

I would say get the 27"... you are gonna have that thing for a while, might as well get as much computer as you can.



wellwhoopdedooo posted:

Is there any difference between declaring overridden methods in the overriding class's @interface and just defining the new @implementation?

Beaten like a red-headed stepchild by rjmccall but yes you can. In fact you can override any method in your implementation or a category and your method will get called instead of the base implementation. You can even override the SDK's implementations via categories (but see below).


rjmccall posted:

....
And you'll just get crazy crashes when calling through the wrong method signature. So, you know, use your newfound knowledge wisely.

Bolded part is important. Just because you can do something doesn't mean you should. This applies to any programming language, but double for dynamic stuff like Javascript and quadruple for a language like Objective-C that combines C's power to shoot yourself in the foot with a JS-like flexibility to modify everything at runtime.

Yes, you can use a category to hijack NSObject's alloc implementation but you have to ask yourself... is that really a good idea?

Sewer Adventure
Aug 25, 2004

samiamwork posted:

So I'm an idiot and created an app in iTunes Connect with the wrong App ID. I deleted it before I submitted anything but still it looks like the app name is gone forever. Is this really true? I've got an email out to the only iTunes Connect info I could find but maybe someone here has info. This seems really stupid.

Also, "Contact Us"?! Wow. They might as well just call that page "Do Not Contact Us".

I really hope I don't have to pick a new name. But I probably will, rather than wait forever for a response.

Edit: reading the dev forums it looks like *other* people can use my name but *I* can't? How does that make sense?

It's gone. But who cares? it's an app id, nobody sees it anyway.

Major Thom
May 7, 2006

By training and a hundred scientific secrets, I became what you see - a human being who lives and thrives under the water

Ender.uNF posted:

I can tell you having a 1920x1200 MBP makes doing iPad screens a much better experience since the whole thing fits onscreen at one time (with no scaling). The same applies to retina screens since they are almost the same size (why iPhone4-enabled apps don't run in retina resolution on the iPad baffles me... it would be a much nicer experience).

I would say get the 27"... you are gonna have that thing for a while, might as well get as much computer as you can.

Much appreciated. That's exactly the sort of advice I was looking for. (I suspect that being able to do full-scale mockups is the sort of advantage that goes without saying - which is why I'm finding it a little tough to articulate into a google search)

Anyway. Thanks again.

take boat
Jul 8, 2006
boat: TAKEN

Major Thom posted:

I've been agonizing over whether to get a 21.5" iMac or a 27" iMac. The hardware isn't the stumbling block - it's the screen resolution.

In short, the 27" has enough vertical resolution for me to easily work on full-size retina mockups in PS. I've always developed and designed on a 15" MBP, and that kind of extra space seems like it could be a game changer.

So I guess my question, to those of you who currently use the 27", is this: would it be agonizing to have to do your work on the 21.5"?

I understand that it's a matter of taste. But still.
I spent over a month coding fulltime on an 11" MBA, borrowed a 21" iMac about two weeks ago, and starting tomorrow will have a shiny new 27" on my desk.

For sure the 21" is an incredible improvement over an 11", so it's all relative -- and better code than we can make was written in a terminal. That said, the 21" isn't quite wide enough to comfortably display two editor columns in XCode, thanks to the left-most navigator column and Objective-C's inclination towards 120+ character lines. It's certainly not wide enough to edit an iPad interface in one column and a header file in the other, but I don't do that often enough to really mind. And you'll love the extra resolution if you run an iPad app in the simulator.

Can you better spend that $500 elsewhere? An iMac is a depreciating asset, but it's one you'll be working in front of for many hours, for the next few years.

mmm11105
Apr 27, 2010
Two quick questions for anyone who may know:

1.How well do HTML to iOS techs like phonegap and appcelerator work. Which is better/what do I have to watch out for?

2.What's the best way to do a small scale local deploy? A restaurant owner I know is planning on doing iPad menus with me making the app(hopefully in HTML). Do I need a enterprise license for a small scale (20-30 devices) deploy, or can this be accomplished with a regular account.

OHIO
Aug 15, 2005

touchin' algebra

mmm11105 posted:

Two quick questions for anyone who may know:

1.How well do HTML to iOS techs like phonegap and appcelerator work. Which is better/what do I have to watch out for?

2.What's the best way to do a small scale local deploy? A restaurant owner I know is planning on doing iPad menus with me making the app(hopefully in HTML). Do I need a enterprise license for a small scale (20-30 devices) deploy, or can this be accomplished with a regular account.

Why not just make a website if that's your skill set? The iPad can use websites no problem.

You get 100 devices for a regular account.

Major Thom
May 7, 2006

By training and a hundred scientific secrets, I became what you see - a human being who lives and thrives under the water

take boat posted:

I spent over a month coding fulltime on an 11" MBA, borrowed a 21" iMac about two weeks ago, and starting tomorrow will have a shiny new 27" on my desk.

For sure the 21" is an incredible improvement over an 11", so it's all relative -- and better code than we can make was written in a terminal. That said, the 21" isn't quite wide enough to comfortably display two editor columns in XCode, thanks to the left-most navigator column and Objective-C's inclination towards 120+ character lines. It's certainly not wide enough to edit an iPad interface in one column and a header file in the other, but I don't do that often enough to really mind. And you'll love the extra resolution if you run an iPad app in the simulator.

Can you better spend that $500 elsewhere? An iMac is a depreciating asset, but it's one you'll be working in front of for many hours, for the next few years.

Thankfully, the money isn't really an issue. It's really more of a self-restraint thing -- I don't want a comically large screen unless it's going to genuinely make it easier to organize my workspace.

That said, I've always dreamed of having a screen that was big enough to satisfy Xcode 4's need for horizontal space. Your comment about running into certain limitations on the 21.5 has probably given me the push I needed. Thanks for the advice!

mmm11105
Apr 27, 2010

OHIO posted:

Why not just make a website if that's your skill set? The iPad can use websites no problem.

You get 100 devices for a regular account.

The client wants both a native experience and protection if the internet goes out. Seemed like the best solution.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Well it turns out my app crashes on iPod Touch 4G devices... no clue why, it works on iPad 2, iPhone 4, and iPhone 3GS.

*sigh* I ordered an iPod Touch today so I can track this down.

lord funk
Feb 16, 2004

Ender.uNF posted:

Well it turns out my app crashes on iPod Touch 4G devices... no clue why, it works on iPad 2, iPhone 4, and iPhone 3GS.

*sigh* I ordered an iPod Touch today so I can track this down.

I know why! At least, if it's the same issue I had.

You need to explicitly generically find the 'Main nib file base name' if its a universal application. I had no idea about this, and only had the (iPhone) and (iPad) nib files set. I figured the iPod would find the (iPhone) setting and use that (it doesn't).

Only registered members can see post attachments!

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

lord funk posted:

I know why! At least, if it's the same issue I had.

You need to explicitly generically find the 'Main nib file base name' if its a universal application. I had no idea about this, and only had the (iPhone) and (iPad) nib files set. I figured the iPod would find the (iPhone) setting and use that (it doesn't).




Well it starts up on the iPod Touch, it just crashes when you try to play a storm. I wish I had a crash log to see what is going on.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

mmm11105 posted:

protection if the internet goes out.

Check this out. And check this out.

Doesn't really help on the "native experience" front though.

samiamwork
Dec 23, 2006

Sewer Adventure posted:

It's gone. But who cares? it's an app id, nobody sees it anyway.

Sorry I wasn't more clear, I'm not complaining about the App ID. I'm complaining that I lost my app *name*.

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!
Is there a way to reference derived files in a project? I'm generating my images from SVG, and the logical place for the images to go seems to be $(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).png, but that just tosses them all in the same folder, which means name collisions. Is there a way to specify a part of a path in the Output Files for a custom build rule? e.g. my project is at /home/me/project, my image source file is in there at Subdir/image.svg, and I want to end up with /home/me/Library/.../DerivedSources/Subdir/image.png.

Is there a way to do that? Or is there a better way to do what I'm trying to do? Obviously I could just rename the images, but that's the easy way and I'm trying to learn.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

I'm trying to draw graphics in a function other than drawRect
code:
@implementation SpriteTest

-(id)initWithCoder: (NSCoder *) coder {    
    if (self = [super initWithCoder: coder]) {
		[self gameLoop];
	}
	
	return self;
}

-(void)gameLoop {
	game.score = 0;
	
	[self loadGraphics];
	[self setupGraphics];
	
	[self initializeTimer];
}


- (void) animateGame:(NSTimer *)theTimer {
	[self setNeedsDisplay];
	[self processInput];
	[self gameLogic];
}


- (void)drawRect:(CGRect)rect {
	[self drawPlayingField];
	[self drawCharacter];
}

-(void) drawControls {
	int bOffset = SCREEN_VRES-BUTTON_HEIGHT;
	[gameButton[0] drawInRect:CGRectMake(BUTTON_WIDTH*0, bOffset, BUTTON_WIDTH, BUTTON_HEIGHT)];
	[gameButton[1] drawInRect:CGRectMake(BUTTON_WIDTH*1, bOffset, BUTTON_WIDTH, BUTTON_HEIGHT)];
	[gameButton[2] drawInRect:CGRectMake(BUTTON_WIDTH*3, bOffset, BUTTON_WIDTH, BUTTON_HEIGHT)];
	[gameButton[3] drawInRect:CGRectMake(BUTTON_WIDTH*4, bOffset, BUTTON_WIDTH, BUTTON_HEIGHT)];
}
The drawControls stuff works, how would I make the drawPlayingfield work in another function? It either doesn't draw or I get an error. I've tried [self drawPlayingField], but I'm thinking I'm just calling it in the wrong way.

dizzywhip
Dec 23, 2005

drawPlayingField isn't in the code you posted, so we can't see what it's doing.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Gordon Cole posted:

drawPlayingField isn't in the code you posted, so we can't see what it's doing.

It's basically this:
code:
[gameTile[0] drawInRect:CGRectMake(TILE_WIDTH*0, tileOffset, TILE_WIDTH, TILE_HEIGHT)];
Basically a loop that draws a bunch of background tiles.

I also have something like 'drawItems' that draws the game objects. Those are all UIImages, just like the gameButtons. When I refer to something like: [this drawWhatever] does it not work because 'this' has to be a function with a CGrect passed to it or something?

What I'm trying to accomplish is I have my game (say Tetris) running and it works okay. But when you complete a line, I want to do an animation where the rest of the pieces 'drop down', so what I did is put something in the method that 'drops' the pieces after you've completed a line(s) that moves the objects down, redraws, pauses, then moves them down another row, redraws, pauses, etc until the pieces 'land'. But no re-draw occurs.It just pauses x times and then the pieces are magically moved all the way down when that loop ends, and the 'animateGame' starts back up.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
You can't do it that way. When you draw outside the context of the normal draw loop, it won't get displayed. That's the reason for calling setNeedsDisplay - to let iOS know that it needs to update part of the screen (it caches the render results to improve performance and make some of the CoreAnimation effects work).

Typically in a game you separate out the concerns of drawing vs game state. For example, just do the calculation to see how many lines need to go away then kick off an animation that will remove the lines and let the logic code path continue. In your drawing code, after every x amount of time you can remove another line and move things down, adjusting the animation object as you go. When the animation is finished the draw code can remove it from the queue.

This is just one approach... There are many other possibilities. If you stay with your current design the performance will be limited but it might not matter for a tetris game, in which case using setNeedsDisplay (after every visible change) might suffice.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Ender.uNF posted:

You can't do it that way. When you draw outside the context of the normal draw loop, it won't get displayed. That's the reason for calling setNeedsDisplay - to let iOS know that it needs to update part of the screen (it caches the render results to improve performance and make some of the CoreAnimation effects work).

Typically in a game you separate out the concerns of drawing vs game state. For example, just do the calculation to see how many lines need to go away then kick off an animation that will remove the lines and let the logic code path continue. In your drawing code, after every x amount of time you can remove another line and move things down, adjusting the animation object as you go. When the animation is finished the draw code can remove it from the queue.

This is just one approach... There are many other possibilities. If you stay with your current design the performance will be limited but it might not matter for a tetris game, in which case using setNeedsDisplay (after every visible change) might suffice.

I realize that, but I thought I put [self setNeedsDisplay] in that other loop and it either didn't re-draw, or crashed. The code is at home or I'd check for sure.

I guess I might as well link that animation to the main timer, since as the game goes faster I'm going to want the leftover pieces to drop faster as well.

Zhentar
Sep 28, 2003

Brilliant Master Genius

rjmccall posted:

you can do the nice covariant-return and contravariant-parameter cases

On a similar note, is there some way to do this without a warning (or suppress the warning)? Or would it be better not to do it at all...

code:
@interface SomeClass {
}
@property (nonatomic,readonly,retain) NSArray* array;
@end

@interface SomeClass ()
@property (nonatomic,readwrite,retain) NSMutableArray* array;
@end

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Zhentar posted:

On a similar note, is there some way to do this without a warning (or suppress the warning)? Or would it be better not to do it at all...

That's not totally unjustifiable, but I'm not surprised that it's not recognized as an exception to the warning. It's worth filing a bug about.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Bob Morales posted:

I realize that, but I thought I put [self setNeedsDisplay] in that other loop and it either didn't re-draw, or crashed. The code is at home or I'd check for sure.

I guess I might as well link that animation to the main timer, since as the game goes faster I'm going to want the leftover pieces to drop faster as well.


Hmm.. if you are calling setNeedsDisplay at the end of your main timer it shouldn't cause a crash but there are plenty of ways to shoot yourself in the foot. Do you remember what the crash was?


edit: I still can't find any reason my app should crash on iPod Touch 4G devices. They have the same graphics hardware as the iPhone 4 right? It is just so wierd... it all works fine on iPad 2, iPhone 4, iPhone 3GS, and the simulator.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Ender.uNF posted:

Hmm.. if you are calling setNeedsDisplay at the end of your main timer it shouldn't cause a crash but there are plenty of ways to shoot yourself in the foot. Do you remember what the crash was?

If I put [self setNeedsDisplay] in the loop (not the game loop but the 'drop loose pieces loop', it never updates the screen.

If I put [self drawPlayingField] it writes this to the console:


Tue May 17 21:57:19 Rocket.local SpriteTest[431] <Error>: CGContextSaveGState: invalid context 0x0
Tue May 17 21:57:19 Rocket.local SpriteTest[431] <Error>: CGContextSaveGState: invalid context 0x0
Tue May 17 21:57:19 Rocket.local SpriteTest[431] <Error>: CGContextSetBlendMode: invalid context 0x0
Tue May 17 21:57:19 Rocket.local SpriteTest[431] <Error>: CGContextSetAlpha: invalid context 0x0
Tue May 17 21:57:19 Rocket.local SpriteTest[431] <Error>: CGContextTranslateCTM: invalid context 0x0

code:
-(void) drawSprite:(int) spriteImage
				 x:(int) x
				 y:(int) y {

	CGContextRef context = UIGraphicsGetCurrentContext();
	CGContextSaveGState(context);
	
	[tile[spriteImage] drawInRect:CGRectMake(x, y, SPRITE_WIDTH, SPRITE_HEIGHT)];
	
	CGContextRestoreGState(context);
}
So basically I'm not getting the context because it's not available where I'm calling it from.

drawPlayingField is basically a loop that calls drawSprite a bunch of times. It's like if I call drawSprite from anywhere except a function that I call from drawRect, it has those context errors. Could I store the context in a global variable or is it guaranteed not to stay the same or something?

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!
OK, so after loving around with custom build rules and aggregates running custom scripts and building straight into the source tree and I don't know what else, I took a look in the app bundle it builds, and everything is just stuffed into one folder there even once I've got things building into separate folders.

Are subfolders other than the system-created stuff like *.lproj just a no-go? If you're not supposed to do it, whatever, I'll make blah-tabBarIcon.png instead of blah/tabBarIcon.png but I fuckin love me some subfolders.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Bob Morales posted:

stuff

This is all from memory so YMMV but you can't store the context because it can and does become invalid; I believe it is actually an error condition to attempt to draw to screen outside of drawRect.

You can create your own bitmap context (matching your view's dimensions and scale) and draw to that, then in drawRect blit that to the screen (which is just another form of deferred rendering). Apple's stated requirements are to update your state, set needs display, then defer the actual drawing to drawRect.

Like I said, iOS is doing all the caching and other nonsense (actually IIRC the drawn pixels are loaded as a texture and rendered on a set of z-ordered polygon surfaces for compositing, which is how iOS does alpha, mixing OpenGL and UIKit, CoreAnimation, etc. Basically the window manager is just another OpenGL 3D app that happens to have special system privileges).

Any drawing that happens outside drawRect is happening outside of this system and you are only asking for trouble if you try to do it differently.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

wellwhoopdedooo posted:

OK, so after loving around with custom build rules and aggregates running custom scripts and building straight into the source tree and I don't know what else, I took a look in the app bundle it builds, and everything is just stuffed into one folder there even once I've got things building into separate folders.

Are subfolders other than the system-created stuff like *.lproj just a no-go? If you're not supposed to do it, whatever, I'll make blah-tabBarIcon.png instead of blah/tabBarIcon.png but I fuckin love me some subfolders.

This isn't directly related but I too like to organize my resources into subfolders and this is one of the single most annoying things about Xcode's retard file/group management and the resources stuff in general.

To get stuff into subfolders in the Resources bundle I had to setup the folder structure how I wanted, copy it to the correct location in the project directory, then add it to Xcode and choose to add a folder reference. Then it got copied into the final bundle with the folder structure intact.

But the resource stuff then refused to load the files so I had to grab the main bundle's path and calculate the path to the resource that way. It really seems that Apple wants you to use long multi-part filenames and actively attempts to prohibit you from any attempt at organizing via the filesystem. This also applies to your source files in general.

My advice: Just give up and accept name mangling. It isn't worth it.



Protip: Create a group in Xcode. Then in the File Inspector pane, click the icon/button next to the group name and it will prompt you for a folder that corresponds to the group. Go to the parent folder for this group (if any), click New Folder, name it the same as the group, then select it.

Viola! Your project structure can now match the on-disk structure, instead of just randomly lumping everything into the root folder. Amazing!


Protip #2: For some mongoloid reason that makes absolutely no sense, Xcode 4 will *not* show you the frameworks available for the currently selected platform like Xcode 3 did. Wondering how the hell to add a reference to MapKit or AVFoundation?
Right-click an existing framework, click Show in Finder, now look at the list of framework folders and find the one you want. Drag the folder from the Finder into Xcode 4 under Frameworks. Fiddle with the trackpad/mouse until you are vaguely sure that it isn't trying to add this framework as a child of another framework.
When the add dialog appears make sure you specify these settings, or curse, undo the damage you did, and restart this entire process: Uncheck "Copy" and select "Create folder references".
May God have mercy on your soul if you both dragged it under an existing framework and forgot to uncheck "Copy"... I think you have to reformat and reinstall the SDK*

*I am not certain if this is a joke or not.

Simulated fucked around with this message at 04:44 on May 18, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Ender.uNF posted:

Viola!

I am 100% not being a typo-correcting asshat, I just love this one because the concept of someone exclaiming "viola" is very funny.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Ender.uNF posted:

You can create your own bitmap context (matching your view's dimensions and scale) and draw to that, then in drawRect blit that to the screen (which is just another form of deferred rendering). Apple's stated requirements are to update your state, set needs display, then defer the actual drawing to drawRect.

I'll just make an off-screen buffer and draw to that.

wwb
Aug 17, 2004

Quick [in]sanity check here -- I've got a harebrained marketing stunt to help deliver. This one involves ipv6, ipads and some way to show that you are in fact browsing the internet over this sexy new IPv6 thing. This is fairly easy to do on a PC -- we just use the firefox showIP extension. But that isn't an option on the iPad. We are looking at building a quick little app that is nothing more than a UIWebView, a textbox to feed it urls and some sort of UI badge saying a site is or is not v6. How horribly complex/involved is this?

App store approval isn't a problem -- we need to show this on our own gear, so deploying straight from XCode will work . . .

skidooer
Aug 6, 2001
I'm very new to OpenGL and 3D in general. I started learning how to do the modelling a month or so back and now I'm starting to focus on the programming end of the spectrum, specifically for iOS.

I'm trying to draw what is essentially a line using GL_TRIANGLE_STRIP. I've created an array of vertices (the dots in the image below) and I'm expecting that it should look something like this:



Now what is strange is that my solution works perfectly in the simulator, but when I tried to install it on the device I see almost nothing, just a few strange artifacts. If I change the drawing mode to GL_LINES, I do get the horizontal lines, as expected.

I am assuming the simulator uses OpenGL and I'm exploiting something that isn't supported by OpenGL ES. Do I have to redefine a previous vertex to complete the triangle? I was assuming it would figure that on its own. Is there a better approach? I need more control than what GL_LINE_STRIP offers, so I do not think it is a viable alternative.

Edit: Turns out bad data was being copied to the device, but not the simulator. It wasn't the drawing routines at all. Though I am still curious if there are any OpenGL gotchas between the simulator and the actual device.

skidooer fucked around with this message at 16:24 on May 18, 2011

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

wwb posted:

This one involves ipv6, ipads and some way to show that you are in fact browsing the internet over this sexy new IPv6 thing.

Can't you use one of those sites that tells you whether you're using ipv6 like http://test-ipv6.com/ and it'll tell you if you're using ipv6?

wwb
Aug 17, 2004

Yes. But what if you are trying to show that website X is actually IPv6 ready and works on the iPad over IPv6.

Like I said, crazy marketing stunt.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

skidooer posted:

Though I am still curious if there are any OpenGL gotchas between the simulator and the actual device.

Yes, thousands of them. The simulator is using your Mac's graphics hardware to draw which means you are running on a different driver, different chip, etc. Almost nothing is the same as the actual hardware. (It isn't simulating the PVR hardware the devices have.)

You definitely need to run on the device to test both drawing and performance.

HiriseSoftware
Dec 3, 2004

Two tips for the wise:
1. Buy an AK-97 assault rifle.
2. If there's someone hanging around your neighborhood you don't know, shoot him.

skidooer posted:

Edit: Turns out bad data was being copied to the device, but not the simulator. It wasn't the drawing routines at all. Though I am still curious if there are any OpenGL gotchas between the simulator and the actual device.

Perhaps the best thing you can do is not assume any sort of OpenGL state coming into your drawing code... if you need something to be enabled, do it explicitly. Since changing OpenGL states can be expensive, you can put together your own set of flags for each OpenGL state you want to use, and keep track of state there, only calling OpenGL when something needs to be changed. Just reset all of our states to an initial value first to make sure your flags are jiving with what's in OpenGL.

I have a cross-development framework I developed where I do the bulk of the work on Windows (Visual Studio is so nice compared to Xcode) and of the times I see differences in rendering between the device and my GeForce GS250 or whatever it is, I know that I'm not setting a state correctly. I'm still doing stuff with OpenGL ES 1.1 now, but I figure it's going to be more complex keeping things the same with 2.0 with the difference in shader capabilities and such.

klem_johansen
Jul 11, 2002

[be my e-friend]
I'm having a weird issue with an international app. It's got Chinese text & audio and it's only available in the Chinese store, but in iTunes the language says "English." I thought about resubmitting it with "Taiwan" as the "localization native development region" but I'm not sure that would work. I can't find anything else that would affect this.

[And yeah, this isn't a traditional localization project because the app involves massive amounts of art and sound in a specific language, so it made sense to make a Chinese-specific app rather than mushing different languages together.]

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe

skidooer posted:

I'm very new to OpenGL and 3D in general. I started learning how to do the modelling a month or so back and now I'm starting to focus on the programming end of the spectrum, specifically for iOS.

I'm trying to draw what is essentially a line using GL_TRIANGLE_STRIP. I've created an array of vertices (the dots in the image below) and I'm expecting that it should look something like this:



Now what is strange is that my solution works perfectly in the simulator, but when I tried to install it on the device I see almost nothing, just a few strange artifacts. If I change the drawing mode to GL_LINES, I do get the horizontal lines, as expected.

I am assuming the simulator uses OpenGL and I'm exploiting something that isn't supported by OpenGL ES. Do I have to redefine a previous vertex to complete the triangle? I was assuming it would figure that on its own. Is there a better approach? I need more control than what GL_LINE_STRIP offers, so I do not think it is a viable alternative.

Edit: Turns out bad data was being copied to the device, but not the simulator. It wasn't the drawing routines at all. Though I am still curious if there are any OpenGL gotchas between the simulator and the actual device.

Do you have to redefine a previous vertex to complete the triangle? No, that's the whole point of GL_TRIANGLE_STRIP, you only provide each vertex once.

Also, remember that it's a simulator, not an emulator. The simulator isn't attempting to recreate an iPhone on your Mac, it's just simulating the iOS environment on OS X. When compiled for the simulator your app is actually being compiled for x86, not ARM, and will run at the full speed of your Mac's CPU and GPU.

So while the simulator does simulate OpenGL ES, as HiriseSoftware said, you're running on a different GPU using a different driver.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply