전 멍청한 녀석이고 OpenGL (Blender)에서 3D 모델링 프로그램으로 만든 잠수함을 표시하려고합니다.Android 및 OpenGL - 다른 개체를 통해 개체보기
잠수함은 구형의 끝이 교차하는 긴 원통을 사용하여 만들어졌습니다.
내가 얻는 문제는 결과를 보면 실린더를 통해 전체 구체를 볼 수 있다는 것입니다. 또한 구를 통해 원통의 끝을 볼 수 있습니다. 조명이 켜지면 나타납니다. 주변 조명과 확산 조명을 사용하고 있습니다. 실린더의 바깥쪽에 반구를보고 싶습니다. 아무 것도 볼 수 없습니다.
나는 얼굴을 도려내는데 두 물체의 앞면을 제거하지만 구가 분명하게 보입니다.
아래 나는 모든 OpenGL 매개 변수를 설정하는 내 onSurfaceCreated 함수를 붙여 넣었습니다. 모든 제안을 부탁드립니다!
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
//
gl.glEnable(GL10.GL_DEPTH_TEST);
//gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glEnable(GL10.GL_POLYGON_OFFSET_FILL);
gl.glEnable(GL10.GL_LIGHTING);
gl.glEnable(GL10.GL_LIGHT0);
// Define the ambient component of the first light
float[] light0Ambient = {0.1f, 0.1f, 0.1f, 1.0f};
gl.glLightfv(gl.GL_LIGHT0, gl.GL_AMBIENT, FloatBufferFromFloatArray(light0Ambient, 4));
// Define the diffuse component of the first light
float[] light0Diffuse = {0.7f, 0.7f, 0.7f, 1.0f};
gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, FloatBufferFromFloatArray(light0Diffuse, 4));
// Define the specular component and shininess of the first light
float[] light0Specular = {0.7f, 0.7f, 0.7f, 1.0f};
float light0Shininess = 0.4f;
//gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPECULAR, FloatBufferFromFloatArray(light0Specular, 4));
// Define the position of the first light
float[] light0Position = {1.0f, 0.0f, 0.0f, 0.0f};
gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, FloatBufferFromFloatArray(light0Position, 4));
// Define a direction vector for the light, this one points correct down the Z axis
float[] light0Direction = {0.0f, 0.0f, -1.0f};
//gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPOT_DIRECTION, FloatBufferFromFloatArray(light0Direction, 3));
// Define a cutoff angle. This defines a 90° field of vision, since the cutoff
// is number of degrees to each side of an imaginary line drawn from the light's
// position along the vector supplied in GL_SPOT_DIRECTION above
//gl.glLightf(gl.GL_LIGHT0, gl.GL_SPOT_CUTOFF, 180.0f);
gl.glEnable(GL10.GL_CULL_FACE);
// which is the front? the one which is drawn counter clockwise
gl.glFrontFace(GL10.GL_CCW);
// which one should NOT be drawn
gl.glCullFace(GL10.GL_BACK);
gl.glClearDepthf(10f);
gl.glPolygonOffset(1.0f, 2);
initShape();
gl.glScalef(0.5f, 0.5f, 0.5f);
}
스크린 샷을 게시 할 수 있습니까? – ChrisF
법선과 같은 소리가 반대로 나옵니다. – Dave
http://img696.imageshack.us/i/13043028.png/ –