1

多くのビットマップと 1 つの翻訳アニメーションを表示するアプリを実行しています。エミュレーターでは、(デバイスから派生した) 幅と高さが入れ替わるというまれな例外を除いて、これは常に機能します。ただし、友人の Galaxy SIII では、テクスチャもクワッドも表示されません。アニメーションが実行されたかどうかを確認しようとした後、実行されませんでしたが、glClear 関数は背景に正しい色を描画します。したがって、プログラムはまだレンダリング中です。次のレンダラーで正投影ビューを使用しています。

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.opengl.GLSurfaceView.Renderer;


public class GLrenderer implements Renderer {

private Context context;
long startTime; 
public GLrenderer(Context context) {
    this.context = context;

}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {       
    //Load the texture for the cube once during Surface creation

    MenuGameLoop.button.now.position_x=0;
    MenuGameLoop.button.past.position_x=0;
    MenuGameLoop.button.loadGLTexture(gl, this.context);
    MenuGameLoop.overlay.loadGLTexture(gl, this.context);
    for(int i=0;i<Splash.cubes.size();i++){
    Block ice=Splash.cubes.get(i);
    ice.loadGLTexture(gl, this.context, ice.width, ice.height,ice.overall,ice.subWidth, ice.subHeight);
    }
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glEnable(GL10.GL_TEXTURE_2D);            
    gl.glShadeModel(GL10.GL_SMOOTH);            
    gl.glClearColor(0.0f, 0.666f, 0.831f, 1f); 
    gl.glClearDepthf(1.0f);                     
    gl.glEnable(GL10.GL_DEPTH_TEST);        
    gl.glDepthFunc(GL10.GL_LEQUAL);             

    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); 
}


public void onDrawFrame(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);    
    gl.glLoadIdentity();
    MenuGameLoop.overlay.draw(gl);      
    gl.glPushMatrix();
    gl.glTranslatef( (float)MenuGameLoop.button.mid.position_x,(float)MenuGameLoop.button.mid.position_y+(Splash.sizeY/2), 0);  
    MenuGameLoop.button.draw(gl);

    gl.glPopMatrix();
    for(int i=0;i<Splash.cubes.size();i++){
        gl.glPushMatrix();
        Block ice=Splash.cubes.get(i);
        gl.glTranslatef (ice.posX,ice.posY, 0); 
        ice.draw(gl);
        gl.glPopMatrix();
        }

}

public void onSurfaceChanged(GL10 gl, int width, int height) {

    if(height == 0) {                   
        height = 1;                         
    }

    gl.glViewport(0, 0, width, height);     
    gl.glMatrixMode(GL10.GL_PROJECTION);    
    gl.glLoadIdentity();                    

    gl.glOrthof(0f, (float)width, (float)height, 0f, 0.1f, 100.0f);

    gl.glMatrixMode(GL10.GL_MODELVIEW);     
    gl.glLoadIdentity();                    
    }
}

上記から問題を推測できない場合、回避する/コードの他のセクションに追加する必要がある特定の事項はありますか?

4

1 に答える 1

0

2 のべき乗テクスチャを使用していることを確認してください。

また、エミュレータでは機能するがデバイスでは機能しない、互換性のない OpenGL ES 構成を選択することもあります。

于 2012-11-28T08:37:55.467 に答える