If you think the Android project Schooner-3D listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2012 Dan Mercer/*www.java2s.com*/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package com.supermercerbros.gameengine.util;
import android.opengl.GLES20;
import android.util.Log;
/**
* A patched copy of {@link android.opengl.GLES20}. In Android
*
*/publicclass GLES2 extends GLES20 {
privatestaticfinal String TAG = "com.supermercerbros.gameengine.engine.GLES2";
privatestaticfinalboolean USE_FIX = android.os.Build.VERSION.SDK_INT < 9;
/**
* (Documentation from <a href="http://www.khronos.org/opengles/sdk/docs/man/">OpenGL ES 2.0 Reference Pages</a>)
*
* @param index
* Specifies the index of the generic vertex attribute to be
* modified.
* @param size
* Specifies the number of components per generic vertex
* attribute. Must be 1, 2, 3, or 4. The initial value is 4.
* @param type
* Specifies the data type of each component in the array.
* Symbolic constants GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT,
* GL_UNSIGNED_SHORT, GL_FIXED, or GL_FLOAT are accepted. The
* initial value is GL_FLOAT.
* @param normalized
* Specifies whether fixed-point data values should be normalized
* (true) or converted directly as fixed-point values
* (false) when they are accessed.
* @param stride
* The byte offset between consecutive generic vertex
* attributes. If stride is 0, the generic vertex attributes are
* understood to be tightly packed in the array. The initial
* value is 0.
* @param offset The byte offset into the buffer object's data store
*/publicstaticvoid glVertexAttribPointer(int index, int size, int type,
boolean normalized, int stride, int offset) {
if (USE_FIX) {
Log.e(TAG, "glVertexAttribPointer is not patched yet!");
// Put patched method here
} else {
GLES20.glVertexAttribPointer(index, size, type, normalized, stride,
offset);
}
}
publicstaticvoid glDrawElements(int mode, int count, int type, int offset) {
if (USE_FIX) {
Log.e(TAG, "glDrawElements is not patched yet!");
// Put patched method here
} else {
GLES20.glDrawElements(mode, count, type, offset);
}
}
// TODO Use NDK to patch GLES20
}