I took the timer code from the Skybox2 and for some reason I am only getting a black square with no texture, here is how I load in my textures
const char* c_szTextureFile[n_TexFile] ={ “n_Map1.pvr”, “n_Map2.pvr”};
for(int texNo = 0; texNo < 2; ++texNo){
if(PVRTTextureLoadFromPVR(c_szTextureFile[texNo], &m_uiTexture[0]) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, “ERROR: Cannot load the texturen”);
return false;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
here is the code for my timer
unsigned long _Time = PVRShellGetTime();
if(_Time > p_Time){
float delta = (float)(_Time - p_Time) * f_Rate;
frame += delta;
}
int time_Loc = glGetUniformLocation(m_ShaderProgram.uiId, “Time”); //This stores the location of the uniform
glUniform1f(time_Loc, frame);
and here is my vert and frag shader
//works with object
attribute highp vec4 inVertex;
attribute mediump vec3 inNormal;
attribute mediump vec2 inTexCoord;
//matrix for scene
uniform mediump mat4 MVPMatrix;
//needed to pass tex coords to frag shader to operate on.
varying mediump vec2 TexCoord;
void main()
{
gl_Position = MVPMatrix * inVertex;
TexCoord = inTexCoord;
}
uniform sampler2D sTexture;
uniform sampler2D sTexture2;
varying mediump vec2 TexCoord;
varying mediump vec2 TexCoord2;
//This gets updated within the main code
uniform highp float Time;
void main()
{
mediump vec4 tex1 = texture2D(sTexture, vec2(TexCoord.x + Time, TexCoord.y + Time));
mediump vec4 tex2 = texture2D(sTexture2, vec2(TexCoord2.x + Time, TexCoord2.y + Time));
gl_FragColor = tex2 * tex1;
}
editor react strangely
from first reading using cubemap, i will propose to change
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
Hi David, this isn’t a cube map its just two 2d textures that I want to move. on a quad that I created.
The ParticleSystem demo is achieving a similar technique