0

I'm using OpenGL ES + GLKit. I've never been this low-level before in my life so I still have to learn a lot of things. I've developed a Unity games before and you just give it a .obj file and corresponding texture and it's done. (UV mapping happens to be inside the .obj file?)

I want to develop a kind of special Toon Shader with some different characteristics for use with 3D model. So I need to write a vertex shader (.vsh) and fragment shader (.fsh) right?

However, I just know that in order to apply a texture to a model with correct UV coordinate, you have to do this in shader? (am I right?) With "Texture Shader".

So, If I want to both apply the texture with UV mapping then apply my special Toon Shader, I have to write both in the same shader? There is no way I can create a plug-and-play Toon shader so I can use it with anything?

As a side question, which file format is a UV coordinate and how can I take that in to a shader program? What kind of attribute variable?

5argon
  • 3,683
  • 3
  • 31
  • 57

1 Answers1

0

So I need to write a vertex shader (.vsh) and fragment shader (.fsh) right?

Yes.

However, I just know that in order to apply a texture to a model with correct UV coordinate

True

There is no way I can create a plug-and-play Toon shader so I can use it with anything?

Check Uber-Shaders

and how can I take that in to a shader program? What kind of attribute variable?

You are defining your attributes in shader by yourself. Check this GLSL tutorial

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
StiX
  • 34
  • 4
  • Don't you just reread your posted answers to find such horrible formatting errors? You could have just seen this from the corner of your eye without even reading anything. – Christian Rau Oct 25 '12 at 08:09
  • As a note, uber shaders are a terrible idea in OpenGL ES due to the performance hit from branching. Instead, you really should be crafting separate shaders that fit your particular rendering condition (or do compile-time assembly of such custom shaders) and avoid any sort of branching. – Brad Larson Oct 26 '12 at 20:44
  • Uber shaders can be done with defines, not with "if (technique)" – StiX Nov 06 '12 at 10:35