in this second part i did the translation but it doesnt work , and i cant see the error
Can someone tell me what is wrong ?
[HEADER]
VERSION 01.00.00.00
DESCRIPTION OGLES3OcclusionQueries
COPYRIGHT Imagination Technologies
[/HEADER]
//
// Effect to render the scene using a cube shadow map
//
[EFFECT]
NAME RenderDiffuse
// GLOBALS UNIFORMS
UNIFORM uWorldViewProjMatrix WORLDVIEWPROJECTION
UNIFORM uWorldViewMatrix WORLDVIEW
UNIFORM uWorldViewIT WORLDVIEWIT
UNIFORM uLightPosView LIGHTPOSEYE
UNIFORM uColour MATERIALCOLORDIFFUSE
UNIFORM sTextureMap TEXTURE0
// ATTRIBUTES
ATTRIBUTE inVertex POSITION
ATTRIBUTE inNormal NORMAL
ATTRIBUTE inTexCoord UV
// SHADERS
VERTEXSHADER DiffuseVertexShader
FRAGMENTSHADER DiffuseFragmentShader
[/EFFECT]
[VERTEXSHADER]
NAME DiffuseVertexShader
[GLSL_CODE]
#define VERTEX_ARRAY 0
#define NORMAL_ARRAY 1
#define TEXCOORD_ARRAY 2
attribute highp vec3 inVertex;
attribute highp vec3 inNormal;
attribute mediump vec2 inTexCoord;
uniform highp mat4 uWorldViewProjMatrix;
uniform highp mat4 uWorldViewMatrix;
uniform highp mat3 uWorldViewIT;
uniform highp vec3 uLightPosView;
varying mediump vec2 vTexCoord;
varying highp float vDiffuse;
void main()
{
gl_Position = uWorldViewProjMatrix * vec4(inVertex, 1.0);
vTexCoord = inTexCoord;
highp vec3 posView = (uWorldViewMatrix * vec4(inVertex, 1.0)).xyz;
highp vec3 lightDirView = normalize(uLightPosView - posView);
highp vec3 normalView = uWorldViewIT * inNormal;
vDiffuse = max(dot(lightDirView, normalView), 0.0);
}
[/GLSL_CODE]
[/VERTEXSHADER]
[FRAGMENTSHADER]
NAME DiffuseFragmentShader
[GLSL_CODE]
uniform sampler2D sTexture;
uniform lowp vec4 uColour;
varying mediump vec2 vTexCoord;
varying highp float vDiffuse;
varying lowp vec3 oColour;
varying lowp vec4 colorCode;
void main()
{
gl_FragColor = texture2D(sTexture, vTexCoord) * uColour * vDiffuse;
}
[/GLSL_CODE]
[/FRAGMENTSHADER]
//
// Renders a single constant material colour
//
[EFFECT]
NAME RenderMaterialColour
// GLOBALS UNIFORMS
UNIFORM uWorldViewProjMatrix WORLDVIEWPROJECTION
UNIFORM uMaterialColour MATERIALCOLORDIFFUSE
// ATTRIBUTES
ATTRIBUTE inVertex POSITION
// SHADERS
VERTEXSHADER MaterialColourVertexShader
FRAGMENTSHADER MaterialColourFragmentShader
[/EFFECT]
[VERTEXSHADER]
NAME MaterialColourVertexShader
[GLSL_CODE]
#define VERTEX_ARRAY 0
#define NORMAL_ARRAY 1
#define TEXCOORD_ARRAY 2
attribute highp vec3 inVertex;
uniform highp mat4 uWorldViewProjMatrix;
void main()
{
gl_Position = uWorldViewProjMatrix * vec4(inVertex, 1.0);
}
[/GLSL_CODE]
[/VERTEXSHADER]
[FRAGMENTSHADER]
NAME MaterialColourFragmentShader
[GLSL_CODE]
uniform lowp vec4 uMaterialColour;
uniform lowp vec4 oColour;
void main()
{
gl_FragColor = uMaterialColour;
}
[/GLSL_CODE]
[/FRAGMENTSHADER]
thanks in advance
david
any help ?
Hi David,
What problems are you seeing? I’ve copied and pasted the PFX code into PVRShaderEditor, but everything is compiling.
Thanks,
Joe
Hello Joe
i should stop to smoke grass !!! it s effectively working sorry about that
^:)^
david