java基于OpenGL ES實(shí)現(xiàn)渲染實(shí)例
本文實(shí)例講述了java基于OpenGL ES實(shí)現(xiàn)渲染的方法。分享給大家供大家參考。具體如下:
1. Run.java文件:
package net.obviam.opengl;
import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class Run extends Activity {
/** The OpenGL view */
private GLSurfaceView glSurfaceView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// requesting to turn the title OFF
requestWindowFeature(Window.FEATURE_NO_TITLE);
// making it full screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Initiate the Open GL view and
// create an instance with this activity
glSurfaceView = new GLSurfaceView(this);
// set our renderer to be the main renderer with
// the current activity context
glSurfaceView.setRenderer(new GlRenderer());
setContentView(glSurfaceView);
}
/** Remember to resume the glSurface */
@Override
protected void onResume() {
super.onResume();
glSurfaceView.onResume();
}
/** Also pause the glSurface */
@Override
protected void onPause() {
super.onPause();
glSurfaceView.onPause();
}
}
2. GlRenderer.java文件:
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView.Renderer;
public class GlRenderer implements Renderer {
@Override
public void onDrawFrame(GL10 gl) {
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}
}
希望本文所述對(duì)大家的java程序設(shè)計(jì)有所幫助。
相關(guān)文章
說(shuō)說(shuō)字符串轉(zhuǎn) OffSetDateTime 你真的會(huì)用嗎
這篇文章主要介紹了字符串轉(zhuǎn) OffSetDateTime 你真的會(huì)用嗎?具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-08-08
servlet之session簡(jiǎn)介_(kāi)動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
這篇文章主要介紹了servlet之session簡(jiǎn)介,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07
springboot中請(qǐng)求地址轉(zhuǎn)發(fā)的兩種方案
在開(kāi)發(fā)過(guò)程中,我們經(jīng)常需要將請(qǐng)求從一個(gè)服務(wù)轉(zhuǎn)發(fā)到另一個(gè)服務(wù),以實(shí)現(xiàn)不同服務(wù)之間的協(xié)作,本文主要介紹了springboot中請(qǐng)求地址轉(zhuǎn)發(fā)的兩種方案,感興趣的可以了解一下2023-11-11
java中使用雙向鏈表實(shí)現(xiàn)貪吃蛇程序源碼分享
這篇文章主要介紹了java中使用雙向鏈表實(shí)現(xiàn)貪吃蛇程序源碼分享,本文直接給出了實(shí)現(xiàn)代碼,需要的朋友可以參考下2015-03-03
Java基礎(chǔ)夯實(shí)之線程問(wèn)題全面解析
操作系統(tǒng)支持多個(gè)應(yīng)用程序并發(fā)執(zhí)行,每個(gè)應(yīng)用程序至少對(duì)應(yīng)一個(gè)進(jìn)程?。進(jìn)程是資源分配的最小單位,而線程是CPU調(diào)度的最小單位。本文將帶大家全面解析線程相關(guān)問(wèn)題,感興趣的可以了解一下2022-11-11
Java?easyExcel的復(fù)雜表頭多級(jí)表頭導(dǎo)入
最近在項(xiàng)目開(kāi)發(fā)中遇到的一個(gè)excel復(fù)雜表頭的導(dǎo)入數(shù)據(jù)庫(kù)操作,下面這篇文章主要給大家介紹了關(guān)于Java?easyExcel的復(fù)雜表頭多級(jí)表頭導(dǎo)入的相關(guān)資料,需要的朋友可以參考下2022-06-06
servlet基礎(chǔ)知識(shí)_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
這篇文章主要為大家詳細(xì)介紹了servlet基礎(chǔ)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07

