Shader Fun

Posted by DesertFox on May 5, 2012, 9:56 p.m.

So, I've decided to upgrade my iOS engine from OpenGL ES 1.1 to 2.0. What does this mean? No more fixed function pipeline! I have to write shaders for everything!

So I did.

First cube is Position-Color vertex.

Second cube is Position-Color-Texture

Those two are sort of boring. You've seen them before. Third cube is better. Its a Position-Color-Texture-TextureID cube - along with the x/y texture coordinates, I also send in the texture ID. For the cube in question, halfway through the cube it switches textures, so you have some faces with one texture, some with another, and some faces that start as one texture and suddenly change to the other.

Finally, the utterly epic green-bullseye glow in the dark blended-texture cube. Rather than render one cube, and then another on top of it with the glowy texture, I just do it in one pass.

Woo!

Next up I'm going to do lighting, then per-pixel lighting, and then bumpmapping!

Comments

Cesque 12 years, 5 months ago

All I can think of is "How did you take screenshots of your phone?"

Or that… and how I love the third cube <3

JuurianChi 12 years, 5 months ago

Photoshop/Gimp, FTW.

flashback 12 years, 5 months ago

That's what the iPhone emulator in XCode looks like, actually.

JuurianChi 12 years, 5 months ago

that's awesome.

Mordi 12 years, 5 months ago

How does the emulator handle the hardware-emulation? I mean, the computer is obviously much more capable than an iPhone. Does it try to emulate the CPU/GPU of the iPhone?

DesertFox 12 years, 5 months ago

Mordi, unfortunately, it doesn' - the emulator runs things in almost exactly the same manner as a device, but the GPU/CPU are on steroids. It is very good emulation, aside from that. On the other hand, it's better than the Android emulator which in my experience ran slower than on device.

Aside from that, I do know the performance specifications of the iOS hardware, and it has more than enough oomph for what I plan.

Snakeman 12 years, 5 months ago

I wonder what Minecraft would look like if all of the blocks had the Position-Color vertex shader cube as their texture.