您的位置:首页 > 编程语言 > ASP

ASP动态网页创建一个简单页面

2010-02-08 21:09 351 查看
有了前面关于Android OpenGL ES的介绍,可以开始创建示例程序OpenGLDemos。

使用Eclipse 创建一个Android项目

Project Name: OpenGLDemos

Build Target: Android 1.6 ( >1.5 即可)

Application Name: Android OpenGL ES Demos

Package Name: com.pstreets.opengl.demo

Create Activity:AndroidOpenGLDemo

采用Android ApiDemos 类似的方法,AndroidOpenGLDemo为一ListActivity ,可以使用PackageManager 读取所有Category为guidebee.intent.category.opengl.SAMPLE_CODE 的Activity。
Android ApiDemos示例解析(2): SimpleAdapter,ListActivity,PackageManager

创建一个OpenGLRenderer 实现 GLSurfaceView.Renderer接口:

public class HelloWorld extends Activity
implements IOpenGLDemo{

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

mGLSurfaceView = new GLSurfaceView(this);
mGLSurfaceView.setRenderer(new OpenGLRenderer(this));
setContentView(mGLSurfaceView);
}

public void DrawScene(GL10 gl) {
gl.glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
// Clears the screen and depth buffer.
gl.glClear(GL10.GL_COLOR_BUFFER_BIT
| GL10.GL_DEPTH_BUFFER_BIT);

}

@Override
protected void onResume() {
// Ideally a game should implement
// onResume() and onPause()
// to take appropriate action when the
//activity looses focus
super.onResume();
mGLSurfaceView.onResume();
}

@Override
protected void onPause() {
// Ideally a game should implement onResume()
//and onPause()
// to take appropriate action when the
//activity looses focus
super.onPause();
mGLSurfaceView.onPause();
}

private GLSurfaceView mGLSurfaceView;

}


其对应在AndroidManifest.xml中的定义如下:

<activity android:name=”.HelloWorld” android:label=”@string/activity_helloworld”>

<intent-filter>

< action android:name=”android.intent.action.MAIN” />
<category android:name=”guidebee.intent.category.opengl.SAMPLE_CODE” />

< /intent-filter>

< /activity>





本例下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: