2011-04-29 10 views
0

Android에서 Matlab 스타일의 히트 맵 플롯을 만들고 히트 맵을 작성하기 위해 GLSurfaceView의 겹치는 조합을 사용하기로 결정했습니다 (히트 맵이 무엇인지 모르는 경우 걱정하지 마세요). 히트 맵 상단의 비트 맵, 비트 맵 등을 수행 할 수있는 SurfaceView입니다. GLSurfaceView를 사용하면 좋은 점을 캔버스 기반의 SurfaceView로 처리 할 수 ​​있습니다. SurfaceView는 투명한 배경을 가지고있어서 GLSurfaceView를 볼 수 있습니다.앞면과 겹치는 SurfaceView를 가져 오는 방법은 무엇입니까?

내 문제는 렌더링 될 때 GLSurfaceView가 "최상위"로 나타나고 SurfaceView가 "bringToFront()"메서드를 사용하여 맨 위로 이동하도록 할 수 없다는 것입니다. 이것을 할 수있는 방법이 있습니까? 나는 연속 렌더링을 사용하지 않기 때문에 GLSurfaceView를 렌더링 할 때 SurfaceView ("auxiliary")를 수동으로 렌더링합니다.

public void onDrawFrame(GL10 gl) { 
    Log.d(TAG, "HeatMapView onDrawFrame"); 

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); 
    gl.glMatrixMode(GL10.GL_MODELVIEW); 
    gl.glLoadIdentity(); 

    heatMap.draw(gl); 
    auxiliary.draw(); // This is the SurfaceView draw 
} 


/** 
* This function draws our heat map on screen. 
* @param gl 
*/ 
public synchronized void draw(GL10 gl) { 
    Log.d(TAG, "HeatMap draw"); 
    if (!openGlSetUp) { 
     gl.glFrontFace(GL10.GL_CW); 
     gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); 
     gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer); 
     openGlSetUp = true; 
    } 

    gl.glDrawElements(GL10.GL_TRIANGLES, curIndexBufferLen, GL10.GL_UNSIGNED_SHORT, indexBuffer); 
    dataDirty = false; 
} 

/** 
* This function draws the axes and bitmaps. 
*/ 
public void draw() { 
    Log.d(TAG, "draw"); 
    Canvas canvas = holder.lockCanvas(null); 

    canvas.drawColor(0, PorterDuff.Mode.CLEAR); 
    Paint paint = new Paint(); 
    paint.setAntiAlias(true); 
    paint.setStyle(Paint.Style.FILL); 
    paint.setTextSize(16); 
    paint.setColor(Color.argb(255,255,255,255)); 
    canvas.rotate(90f, 300, 300); 
    canvas.drawText("Azimuth", 250, 590, paint); 
    canvas.rotate(-90f, 300, 300); 
    canvas.drawText("Freq (GHz)", 525, 555, paint); 

    holder.unlockCanvasAndPost(canvas); 
    bringToFront(); 
} 

protected void onVisibilityChanged (View changedView, int visibility) { 
    bringToFront(); 
} 

분명히 이것은 모든 코드가 아닙니다. 가장 관련성이 높은 부분을 표시하려했습니다. SurfaceView (보조)를 맨 위에 놓을 수있는 방법에 대한 아이디어가 있습니까?

답변

관련 문제