Using your code "As-Is" and I get an error... not just in AppGameKit v2 but also AppGameKit Studio... it's a nearly identical error about uvVarying being unidentified and unable to convert temp float to temp highp 2-component vector of float
... mind unlike you, I'm getting that error with both the Object and Mesh NormalMap Functions.
Why there is this issue... I can't be sure, but I think it has something to do with the DirectX Object itself... which is in the archaic ASCII .X Format.
Now a big issue is, there isn't much nowadays that'll actually Import it (the Blender .X Importer is Binary Format only).
You will get it working with:
Default.Normal.glsl
attribute highp vec3 position;
attribute mediump vec3 normal;
attribute mediump vec2 uv;
varying highp vec3 posVarying;
varying mediump vec3 normalVarying;
varying mediump vec2 uvVarying;
varying mediump vec3 lightVarying;
uniform highp mat3 agk_WorldNormal;
uniform highp mat4 agk_World;
uniform highp mat4 agk_ViewProj;
uniform mediump vec4 uvBounds0;
mediump vec3 GetVSLighting( mediump vec3 normal, highp vec3 pos );
void main()
{
uvVarying = uv * uvBounds0.xy + uvBounds0.zw;
highp vec4 pos = agk_World * vec4(position,1.0);
gl_Position = agk_ViewProj * pos;
mediump vec3 norm = normalize(agk_WorldNormal * normal);
posVarying = pos.xyz;
normalVarying = norm;
lightVarying = GetVSLighting( norm, posVarying );
}
Default.Pixel.glsl
uniform sampler2D texture0; // Diffuse
uniform sampler2D texture2; // Normal
varying highp vec3 posVarying;
varying mediump vec3 normalVarying;
varying mediump vec2 uvVarying;
varying mediump vec3 lightVarying;
mediump vec3 GetPSLighting( mediump vec3 normal, highp vec3 pos );
mediump vec3 ApplyFog( mediump vec3 color, highp vec3 pointPos );
void main()
{
mediump vec3 norm = texture2D(texture2, uvVarying).rgb;
norm = normalize(norm) * normalize(normalVarying);
mediump vec3 light = lightVarying + GetPSLighting( norm, posVarying );
mediump vec3 color = texture2D(texture0, uvVarying).rgb * light;
color = ApplyFog( color, posVarying );
gl_FragColor = vec4(color,1.0);
}
They're just the Default Shaders that would normally be generated... not sure why they're failing with this model.
Still you can just manually load the shaders and everything ends up fine.
Mind, as a point of note... the Vertex Normals are going to cause either some Faceted Lighting or Lessen the Normal Effect.
You'll probably want to either recalculate the Normals (via Memblocks) or export to a common universal format (like OBJ for example).
I am in the midst of an OBJ Format Importer / Exporter for a current project, so I'll see about making a Stand-Alone Version at the same time ... as A LOT of the TGC Assets really should be in FBX Format.
It made sense with DarkBASIC Professional to stick with .X because FBX at the time was still quite new, but it's been 15 years; the only other Formats that have had the same longevity is OBJ and DAE ... and frankly that's only because of CAD.
It's also weird how they dropped support for DDS (DXT), despite those formats merely being Microsoft Branded, Binary Colour Compression 1, 4, 5, 6 and 7.
AMD had Open Libraries for said Formats that are essentially "Out-of-the-Box" Usable from their Media SDK.