Hi at all,
I am developing an application which use some OPENGLES feature, I have
some problem when I want change textures of a object which I had
created before, this is my code:
public OpenGLRenderer(Context context,Bitmap first,Bitmap
second,Sphere sphere) {
[.....creation a sphere with vertex and texture coord]
}
public void onSurfaceCreated(GL10 gl10, EGLConfig config) {
Load texture:
gl.glGenTextures(2, textures_ids);
//...and bind it to our array
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures_ids.get(0));
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_LINEAR);
gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_CLAMP_TO_EDGE );
gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_CLAMP_TO_EDGE );
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, first, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures_ids.get(1));
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_LINEAR);
gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_CLAMP_TO_EDGE );
gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_CLAMP_TO_EDGE );
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, second, 0);
[other stuff..]
}
public void onDrawFrame(GL10 gl10) {
[...........draw the sphere......]
}
public void onSurfaceChanged(GL10 gl, int width_, int height_) {
gl = (GL11) gl;
this.width = width_;
this.height = height_;
this.width = width_;
this.height = height_;
if(height_ == 0) {
//Prevent A Divide By Zero By
this.height = 1;
//Making Height Equal One
}
gl.glViewport(0, 0, width, height);
Log.d("OpenGLRenderer", "onSurfaceChanged");
}
My problem is that I want change texture when users perform some
action, but I cannot because the three methods are already called!
What's wrong?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en