No 'slide' images have been detected!
How To Add Images To Your Slider
  1. View your project in edit mode by clicking the edit button.
  2. Import or drag and drop an image into your editor.
  3. Double click the image and in the popup menu change the filename to something that starts with 'slide'.
  4. Add as many images as you want and make sure to also change the filenames to something that starts with 'slide' (e.g. slide-2.jpg, slide-3.jpg).

Software, Hardware, Research – Results

iPhone

iPhone wireless logger

As everyone knows, you can’t run gdb on an iPhone/iPod (and I assume, iPad) that’s not tethered to your development machine.

This really sucks if you are trying to debug an app that relies on or controls an external accessory; you’re basically working blind unless you want to litter your iPhone screen with UIAlertViews. That approach works for very isolated bits of code, but if you have repetitive events or lots of points in your code you need inspect, it gets old fast.

So, after procrastinating a couple of months, I’ve whacked together a simple wireless logger class that should be easy to dump into your code base. Using the Acceleromater Simulator code as a template, I created for general use the WLog singleton.

The WLog class supports sending NSString messages to another computer via UDP broadcast, which means via WiFi when you’re using it for an iPhone/iPod/iPad app. All the receiver has to do is listen to a prescribed port. I chose the default port to be 5169 since it’s part of an unreserved block of port numbers.

The source files for a simple iPhone test app and a Java receiver are available at GitHub.


Wikipedia Affiliate Button

OpenGL ES multi-texture example

This is the first in what I hope to be a couple of examples on using OpenGL on the iPhone. As we all know, there are examples around, but not that many. Jeff LaMarche is porting some of the NeHe tutorial examples, which is great.

I know that OpenGL ES 1.1 is what’s in use on the iPhone, but have been working my way through the OpenGL ES 2.0 Programming Guide anyway, trying to make things work.

To make a long story short, I started by wanting to do some water effects alá Koi Pond and ended up looking at multi-texturing. After some thrashing around, the solution is really straightforward. The main “mental” hurdle (in my case) was to remember that OpenGL implementations are state machines. You set the state and then execute the rendering.

What we’re going for in this example is what is shown on page 223 of the OpenGL ES 2.0 Programming Guide, namely one texture (brick wall) modulated by another (a light map). The effect is that of a light shining on a wall.



To make this simple, I’ve based this example on the PVRTextureLoader example from Apple, which you need to get and, if you are going to run the example on a device, configure for your registered device(s). We’ll stick with the brick texture that comes with it, but will need a light map for the modulation. For that you can download the OpenGL ES 2.0 Programming Guide sources and grab the image, or just use the image below.




The inspiration for the multi-texturing was taken from the Oolong engine Per-PixelLighting example (Oolong Engine2/Examples/Renderer/). All the code changes required are made in the EAGLView.h and EAGLView.m files.

The light map is a second texture, so we need to define an index for it to be used in the GLuint _textures[kNumTextures] array. Near the top of EAGLView.h, add the enum indicated below.

enum
{
kTexturePvrtcMipmap4,
kTexturePvrtcMipmap2,
kTexturePvrtc4,
kTexturePvrtc2,
kTextureMipmap,
kTexture,
kTextureLightMap,
kNumTextures
};



Add the lightmap.png file to the Resources group in the project.

Now in EAGLView.m, add a loadImageFile statement to the loadTextures method after the two existing statments;

	[self loadImageFile:@"Brick" ofType:@"png" mipmap:TRUE texture:kTextureMipmap];
[self loadImageFile:@"Brick" ofType:@"png" mipmap:FALSE texture:kTexture];
[
self loadImageFile:@"lightmap" ofType:@"png" mipmap:FALSE texture:kTextureLightMap];



The last change is to the drawView method. Instead of showing diffs, here’s the whole method;

- (void)drawView
{
const GLfloat squareVertices[] = {
-
1.0f, -1.0f,
1.0f, -1.0f,
-
1.0f, 1.0f,
1.0f, 1.0f
};
const GLfloat squareTexCoords[] = {
0.0, 1.0,
1.0, 1.0,
0.0, 0.0,
1.0, 0.0
};
GLenum err;

[EAGLContext setCurrentContext:_context];

glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
glViewport(
0, 0, _backingWidth, _backingHeight);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-
1.0f, 1.0f, -1.5, 1.5, 1.0f, 10.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef(_scale, _scale,
1.0f);
glTranslatef(
0.0f, 0.0f, -2.0f);
glRotatef(_rotate,
1.0f, 0.0f, 0.0f);

glClearColor(
0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

glVertexPointer(
2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);

// we'll be doing multitexture operations, so we need to specify texture
// coords for all (2 in this example) textures
glClientActiveTexture(GL_TEXTURE0);
// first texture
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(
2, GL_FLOAT, 0, squareTexCoords);
glClientActiveTexture(GL_TEXTURE1);
// second texture
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(
2, GL_FLOAT, 0, squareTexCoords);

// Enable 2D texturing for the first texture.
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);

// Enable 2D texturing for the second texture.
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);

// We are trying for the multi-textured lighting effect from the OpenGL
// ES 2.0 book, page 223, Figure 10-3. The relevant shader equation is
// basecolor * (lightcolor + 0.25), so we set the constant as a base colour
glColor4f(
0.25f, 0.25f, 0.25f, 0.25f);

// Set the light map has the current texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, _textures[kTextureLightMap]);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _minTexParam);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _magTexParam);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, _anisotropyTexParam);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

// add the light map to the constant 0.25
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);

// Now set the background map (bricks) and modulate (multiply)
glActiveTexture(GL_TEXTURE1);
// we'll keep this code here as _texSelection will never be our lightmap
glBindTexture(GL_TEXTURE_2D, _textures[_texSelection]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _minTexParam);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _magTexParam);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, _anisotropyTexParam);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

/* Set the texture environment mode for this texture to combine */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);

/* Set the method we're going to combine the two textures by. */
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);

/* Use the previous combine texture as source 0*/
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);

/* Use the current texture as source 1 */
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);

/*
Set what we will operate on, in this case we are going to use
just the texture colours.
*/

glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);

glDrawArrays(GL_TRIANGLE_STRIP,
0, 4);

glDisable(GL_TEXTURE_2D);

glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
[_context presentRenderbuffer:GL_RENDERBUFFER_OES];

err = glGetError();
if (err != GL_NO_ERROR)
NSLog(
@"Error in frame. glError: 0x%04X", err);
}



I’ve added extra comments to help understand the changes. The only other thing worth noting is the glTexParameteri statements applied to the light map texture. Since the glBindTexture call for the light map is fixed, we could have moved these outside the drawView method and saved some cycles. However, I put them in as the germ of a “reader exercise” to add mipmap support for the light map. When you try the demo controls, you’ll see what I mean ;-)

The final result should look like the screenshot below.

After this, I’ll be playing with normals. I’ve managed to create a faux distortion effect by shifting texture vertices, so the next step is to look at lighting and surface effects...





Finishing the transition...


That was quick.

I got a call two days ago from Apple saying the transition was pretty much complete. All I had to answer was a question about what user id did I use for ADC. Easy.

As it was quicker than I thought, I had yet to get my banking info in order, which took another day. With my new account in hand today at noon, I was able to complete the contract and banking info stuff on iTune Connect. At least I hope I did...

There may be a couple of hitches.
  1. My ADC/iPhone developer account has most things changed over to my company name, TechConficio, but various forms still default to my name with no option to edit it. Hmmm...
  2. On the contact info form, Apple asks for several contacts (main representative, financial, etc.), but as there’s only me right now, it seems not to like my split personalities. We’ll see if that’s a real problem
The main place this may be a problem is on the W-8BEN form. It gets generated by Apple and sent to you via email. I’m supposed to sign it and return it. But the name is not my company name, so I had to fix things with a pen and then send it in. Hope that works.

The other tricky thing, and something that’s specific to Canada and, thus, surely different in other countries, is getting the banking info right. I opened a chequeing account for TechConficio. On the iTunes Connect banking info form, the organization name is my name, but I can set the account holder name to TechConficio. So that’s okay. On the iTunes Connect form, the other important info is as follows
  • Branch/Branch ID: is the 5-digit branch ID as per the bottom of your cheque
  • Account Number: is branch ID concatenated with account number for a total of 12 digits
  • Bank Swift Code: can be got by calling your bank
  • The Transit number: is 4-digit institution number (add leading zeros if needed) concatenated with 5 digit branch id
Institution numbers in Canada can be found by Googling... Various cheque numbers are identified below



Hope this can help some of you...

Going from individual to corp iPhone Developer

Like lots of people, I found it expeditious to start my iPhone development “career” as an individual developer. At the time, I did not have an active company so applying as a corporation wasn’t possible.

Now, looking to get my first app up on the App Store, I thought it wise to consider whether I want to continue as an individual developer or convert to a corporation. As I went thought some of the steps to getting on the App Store (as per the iPhone developer portal tools and information), I could see that some of the hoops a Canadian developer has to jump through would be easier as a corporation.

For the direct benefit of fellow Canadians, and I hope partial benefit for other nationalities, I’ll share the various steps and (I hope not too many) tribulations as I get through them.

Day 1 (Yesterday) Incorporation

Started process to incorporate TechConficio:

  1. Started with the Government of Alberta business service pages.

  2. Collected the necessary information about company name, directors, address, etc. for the 3 forms that had to be submitted.


  3. A NUANS report is also needed; I used an online service to perform the name search (NUANS, so-called). They were great. I submitted the name (after Googling to see what my chances were) and within 30 minutes got a phone call to saying the name looked good and how would I like to pay for the report. 30 minutes later the report was in my inbox.

  4. Drove to the nearest Level 2 registry, which is also an Alberta Motor Association branch, to complete the submission. As it was Monday at 3:10 pm, it was absolutely dead and in 10 minutes my company was formed. All the necessary legal docs were printed on the spot.


Done and Done!!!

Day 2 (Today) GST/HST number

To get an app on the App Store, you need to provide various financial info include a GST number.

Used the Government of Canada’s online system to get a GST/HST number. Following the steps at the Business Number (BN) registration site, I was able to get a Corporate account number and GST/HST account number in less than an hour.

Day 2 (Today) EIN for the US

As per the instructions and tips on the iTunes Connect site, I phoned the IRS phone number for international applicants: 215-516-6999. Despite my Canadian accent, I was able to easily convey the needed information to the nice lady and eventually get an EIN. She promised I’d get a notice from the IRS regarding it in about 2-3 weeks, maybe a bit longer, but all I needed to proceed is the EIN. The other stuff being sent is for my records.

I really recommend reading the W-8BEN instructions and tips from the iTunes Connect site, and downloading and reviewing the IRS’s SS4 form. Filling out the SS4 gives you all the info you need when you make the call.

Day 2 (Today) Converting from an individual developer to corporate developer

The best advice on the net seemed to indicate that phoning Apple’s Developer Programs support people would be the fastest approach (as opposed to using the form-driven email contact page). I called 800 633 2152 and after a short wait got a very helpful Australian-accented woman. Again, the Canadian accent was a bit of a challenge.

She first asked for my original Enrollment ID (for the individual developer application), which I didn’t have handy. So she used my Apple ID (@mac.com) to track me down.

She was very careful to outline what would happen if I chose to convert status, namely that my developer account would be disabled for about a week, maybe more. Since I have certificates that will continue to allow me to target my devices, I’m not too worried. Just means my app submission is on hold.

After explicitly asking if I wanted to proceed, she pulled the plug on my account and sent me an email with a link to follow for the next step in the process. She patiently waited until I had received the email (seconds) and then wished me well.

The email contained a link to the developer login page. As I have two ADC IDs, I had to be careful to use the one that I told her. As I learned by accident with the individual developer application, using the wrong email/ADC ID screws things up a lot.

Once through the login, I was asked to update my profile to include the correct corporate info. After double-checking my changes, I submitted them and was take to a page telling me to wait for an email...



After about 2 hours, I received and email asking me to fax one of three possible forms of corporate identification back to Apple. No problem since I had them handy from yesterday.

That’s where things stand right now. I’m hoping the rest of the process takes only a short time.


iPhone UI intuitiveness

So, when designing an iPhone/Touch app, how do you decide how much detail to build in on using the UI? I recently was questioning whether or not to repeatedly tell uses that double-tapping the screen/view will toggle a menu. Is it intuitive to double-tap?

On the Mac, most people know about double-clicking and I don’t feel the need to let them know to do that. Option-clicking is a different thing and there should be a tool tip or doc that explains it. What do you think?

With the iPhone, we all see little kids that just start jabbing away and quickly figure out all the possible touch combos to run an app. Older, perhaps dogmatic(?) users take longer to figure things out.

To whom should one cater?

Accessorizer

Coming from OS X development, it’s really no surprise that Kevin Callahan’s Accessorizer utility has been invaluable to me in starting up with iPhone dev. I strongly recommend checking it out, especially his screencast on integrating with XCode.

The blog entry at iPhone Development is also very informative.