→ bleed1979:StackOverflow上的做法是把文字訊息的那兩塊放圖片。 09/18 14:45
→ bleed1979:把字寫在圖片上,再把圖片放到素材上。 09/18 14:46
→ bleed1979:我來實作看看,有困難再回報,如成功貼源碼。 09/18 14:46
→ bleed1979:使用上面提到的方法失敗了,不過目前在研究spritetext 09/18 22:37
→ qrtt1:opengl 畫的快的同時,它 Thread 佔用系統資源很多。 09/18 23:24
→ qrtt1:如果你是做 Game 那就無妨,應該就讓 opengl 全力跑 09/18 23:24
→ qrtt1:update state 其實不太需要到 cpu resource。 09/18 23:24
→ qrtt1:而效能是整體的感覺,要注意會不會被render thread拖慢其他 09/18 23:27
→ qrtt1:的部分給使用者的感覺。 09/18 23:27
先感謝 badwork 給的一些提示線索
可以用出來了
我的做法是
layout 部份是採用
FrameLayout
- FrameLayout (要放全螢幕畫面的 OpenGL, 取個名字叫 fl_opengl)
(雖是全螢幕的, 但要畫的圖是在中間的正方形那一塊,
所以才會想要用這樣的 layout)
- LinearLayout (放最上面的文字輸出,可能會用到兩三排所以用Linear方式
- RelativeLayout (放最下面的文字或按鈕,為了置底所以用Relative方式)
先把 main.xml 定義好,
再來寫 activity 部份.
// class 裡的屬性
private GLSurfaceView glSurface;
FrameLayout fl_opengl;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// 先跟平常的 android app 一樣,
// 有 onCreate() 跟 setContent(R.layout.main)
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// 取得要放 OpenGL 畫面的 FrameLayout-View
fl_opengl = (FrameLayout)findViewById(R.id.fl_opengl);
// 執行OpenGL動作, 再把 OpenGL Surface View 連接到 fl_opengl
glSurface = new GLSurfaceView(this);
glSurface.setRenderer(xxx);
fl_opengl.addView(glSurface);
}
※ 編輯: ericinttu 來自: 59.117.117.181 (09/19 06:19)