1、设置为全屏:
在activity中设置:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 隐藏title栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
// 隐藏时间、电池栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
mView = new GL2JNIView(getApplication());
setContentView(mView);
}
2、glColorPointer
void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
第一个参数必须是4。
3、glTexImage2D
http://www.khronos.org/opengles/documentation/opengles1_0/html/glTexImage2D.html
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
internalformat
- Specifies the color components in the texture. Must be same as
format
.看到了没,internalformat must be same as format. - 4、static {
System.loadLibrary(“stlport_shared”); // 加载stl的动态库
System.loadLibrary(“png”); // 加载gl2库
System.loadLibrary(“gl2jni”); // 加载gl2库} - 动态库加载时,有顺序限制,如gl2jni需要png库,则需要先加载png库,再加载gl2jni库。如果提前加载gl2jin库则会失败。
- 5、error: exception handling disabled, use -fexceptions to enable。
- 错误解决方案:
- Application.mk 中添加:APP_CPPFLAGS += -fexceptions
- 6、C++中要显示给指针赋值为NULL
0 条评论。