私はJavaとOpenGLが初めてです。
3D オブジェクトを同時に表示できるカメラ プレビュー画面を取得しようとしています。API デモのサンプルを見て、API デモの例のコードを組み合わせるだけで十分だと思いました。しかし、どういうわけか機能していません。これにより、起動時に強制的にシャットダウンされ、エラーはヌルポインター例外として言及されます。誰かが私とどこで間違ったのか、そこからどのように進むべきかを共有できますか. コードの組み合わせは次のとおりです。
myoverview.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.opengl.GLSurfaceView
android:id="@+id/cubes"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<SurfaceView
android:id="@+id/camera"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
myoverview.java
import android.app.Activity;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.Window;
public class MyOverView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide the window title.
requestWindowFeature(Window.FEATURE_NO_TITLE);
// camera view as the background
SurfaceView cameraView = (SurfaceView) findViewById(R.id.camera);
cameraView = new CameraView(this);
// visual of both cubes
GLSurfaceView cubesView = (GLSurfaceView) findViewById(R.id.cubes);
cubesView = new GLSurfaceView(this);
cubesView.setRenderer(new CubeRenderer(false));
// set view
setContentView(R.layout.myoverview);
}
}
GLSurfaceView.java
import android.content.Context;
class GLSurfaceView extends android.opengl.GLSurfaceView {
public GLSurfaceView(Context context) {
super(context);
}
}
ノート :
残りのファイルは、API デモの単なるコピーであるため、記載しませんでした。cameraView は camerapreview.java の例を参照し、CubeRenderer は CubeRenderer.java および Cube.java の例を参照します。どんな助けでも大歓迎です。
申し訳ありませんが、フォーマットの間違いによりコーディングが適切でなかったことを認識していませんでした.