Last Ray of Hope Home of Kaluriel Hargrove

27Aug/11Off

Even heroes fail sometimes

1000 Heroz HD

1000 Heroz HD

For a "HD" game, the graphics are really crap on the iPad 2. And no antialiasing, shame on you RedLynx.

Tagged as: , No Comments
26Aug/11Off

XCode4 Build Rules for iOS

For a while now I have been manually compiling files since my asset conversion pipeline tool is not quite finished yet.

So I took at look into Build Rules in XCode. My main trouble within using them was finding the environment variables, even googling them doesn't turn up much information.

I think the output files act as an error check, if the output file fails to appear then the tool failed.

One other thing I had an issue with was the source files list. I tried comma and semi colon delimiters, and spaces, but the TGA file kept giving the warning on Tree1.tga. I have yet t0 find the a way to do this without multiple entries. And I'm thinking a separate tool for building files may be easier.

 

Tagged as: , No Comments
25Aug/11Off

iPhone Orientation

Earlier I wanted to test my engine with autorotation for when an iOS device's orientation changes. I spent a fair bit of time trying to work out why, sure that I had written some code somewhere to stop it from triggering.

After creating another app and still haven't the same problem, I was about to report it as a bug when the answer dawned on me, I had the orientation lock on.

It would be nice if you could do it on an application basis as well as a global one, since I only turn it on because photos get orientated incorrectly.

The contents of my "Useless" app folder: Stocks, Weather, Contacts, Calculator, Voice Memos, Compass, Reminders. If only you could turn off the default apps as well.

On another note, I've added a page next to website for iOS specific links.

Tagged as: No Comments
18Aug/11Off

iOS: Using Separate Shaders

One of the lovely additions to iOS5 is there is now the ability to use separate vertex and fragment shaders (GL_EXT_separate_shader_objects).

The first step in using separate shaders is to create an object to bind them onto that will be our overall shader program, known as a pipeline object.

GLuint gProgramPipeline = 0;
GLuint gVertexProgram = 0;
GLuint gFragmentProgram = 0;
 
//
//
int main()
{
	//
	CreatePipeline();
	CreateShaders();
 
	//
	BindShadersToPipeline();
 
	//
	do
	{
		//
		UpdateUniforms();
 
		//
		BindPipeline();
		DrawSomething();
		UnbindPipeline();
	}
	while( true );
 
	//
	DestroyShaders();
	DestroyPipeline();
}
 
//
//
void CreatePipeline()
{
	glGenProgramPipelinesEXT( 1, &gProgramPipeline );
}
 
//
//
void DestroyPipeline()
{
	if( gProgramPipeline )
	{
		glDeleteProgramPipelinesEXT( 1, &gProgramPipeline );
		gProgramPipeline = 0;
	}
}

This pipeline object acts similar to vertex array object (VAO) only with shader programs, however instead of using glUseProgram, a separate function glUseProgramStagesEXT() must be used to bind the shader program to the pipeline, specifying the role of the shader program.

//
//
void BindShadersToPipeline()
{
	glUseProgramStagesEXT( gProgramPipeline, GL_VERTEX_SHADER_BIT_EXT, gVertexProgram );
	glUseProgramStagesEXT( gProgramPipeline, GL_FRAGMENT_SHADER_BIT_EXT, gFragmentProgram );
}

Updating uniforms is slightly different as well.

//
//
void UpdateUniforms()
{
	//
	GLint uniformLoc = glGetUniformLocation( gVertexProgram, "myVertUniform" );
	glProgramUniform1fEXT( gVertexProgram,
			       uniformLoc,
			       1.248f );
 
	uniformLoc = glGetUniformLocation( gFragmentProgram, "myFragUniform" );
	glProgramUniform1fEXT( gFragmentProgram,
			       uniformLoc,
			       6.1218f );
 
	//
	uniformLoc = glGetUniformLocation( gVertexProgram, "myCommonUniform" );
	float commonValue = 2.0f;
 
	glProgramUniform1fEXT( gVertexProgram,
			       uniformLoc,
			       commonValue );
 
	uniformLoc = glGetUniformLocation( gFragmentProgram, "myCommonUniform" );
	glProgramUniform1fEXT( gVertexProgram,
			       uniformLoc,
			       commonValue );
}

Finally to use the program pipeline, we just need to bind it.

//
//
void BindPipeline()
{
	glBindProgramPipelineEXT( gProgramPipeline );
}
 
//
//
void UnbindPipeline()
{
	glBindProgramPipelineEXT( 0 );
}

fef

18Aug/11Off

Bootstrap Server and thread yielding

One annoying this about iOS development is when the device crashes and you get the following message.

"Couldn't register com.yourcompany.youapp with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger."

It usually means a restart of a few minutes. I kept getting these when using an iterative formula to calculate something. I have made a mistake of subtracting instead of adding, and I ended up getting into an infinite loop (I really should have put an attempt timeout in the while condition).

This happened about 5-6 times before I was able to track it down, and when working on the main thread, I couldn't seem to put a breakpoint in to debug it.

However I found that calling sched_yield() on the main thread within my loop, did stop (or at least drastically reduce) the number of bootstrap failures.

"Internet Explorer, the Number One browser for downloading a better browser."

18Aug/11Off

Domino’s New Gourmet Range

On the Domino's website for Brighton today had three new pizzas. And to mark the occasion they have a new gourmet deal if you buy two, you get them for £19.99 as well as some extras.

If you do not want two, then you can always just buy one from the special's option, however they cost more than a standard large, because let us not forget that they are gourmet.

Or are they? On the "Create Your Own" option they have added a lot of these new ingredients, most of which I reckon are probably just the old ones with a few new additions.

So I tried creating the first one in the list, the salami and pepperoni, and it came to £1.60 cheaper.

Firenze

Ventricina Salami, Pepperoni and Peruvian Roquito Peppers on a thin crust base.

Special's Cost: £17.49

Create Your Own Cost: £15.89

Price Increase: £1.60

Florentine

Baby Spinach, SunBlush Baby Plum Tomatoes and Greek Feta Cheese on a thin crust base.

Special's Cost: £17.49

Create Your Own Cost: £15.89

Price Increase: £1.60

Rustica

Chicken breast strips, naturally smoked bacon rashers, baby spinach and SunBlush baby plum tomatoes on a thin crust base.

Special's Cost: £17.49

Create Your Own Cost: £17.19

Price Increase: £0.39

Accident? I do wonder if when they realise this or get told they'll reduce the cost of the pizza, increase the price of the new toppings, or just claim there is "special sauce" that costs more.