Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package com.hello; import java.io.IOException; import java.io.InputStream; import java.nio.ByteOrder; import java.nio.IntBuffer; import java.nio.ShortBuffer; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL11; import javax.microedition.khronos.opengles.GL11Ext; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Bitmap; import android.opengl.GLUtils; public class Sprite{ public Sprite(Context context, GL10 gl, int resourceId){ short[] mIndicesArray = {0,1,2,3}; float[] coords = { -0.1f, 0.1f, 0f, //0 top left -0.1f, -0.1f, 0f, //1 bottom left 0.1f, 0.1f, 0f, //2 top right 0.1f, -0.10f, 0f //3 bottom right }; mNrOfVertices = 4; float[] texCoords = { 1f,1f, 1f,0f, 0f,1f, 0f,0f, }; float[] normalCoords = { 0f,0f,1f, 0f,0f,1f, 0f,0f,1f, 0f,0f,1f }; mContext = context; loadTexture(gl,resourceId); ByteBuffer vbb = ByteBuffer.allocateDirect(coords.length * 4); vbb.order(ByteOrder.nativeOrder()); mVertexBuffer = vbb.asFloatBuffer(); ByteBuffer ibb = ByteBuffer.allocateDirect(mIndicesArray.length * 2); ibb.order(ByteOrder.nativeOrder()); mIndexBuffer = ibb.asShortBuffer(); ByteBuffer tbb = ByteBuffer.allocateDirect(texCoords.length * 4); tbb.order(ByteOrder.nativeOrder()); mTexBuffer = tbb.asFloatBuffer(); ByteBuffer nbb = ByteBuffer.allocateDirect(normalCoords.length * 4); nbb.order(ByteOrder.nativeOrder()); mNormalBuffer = nbb.asFloatBuffer(); mVertexBuffer.put(coords); mIndexBuffer.put(mIndicesArray); mTexBuffer.put(texCoords); mNormalBuffer.put(normalCoords); mVertexBuffer.position(0); mIndexBuffer.position(0); mTexBuffer.position(0); mNormalBuffer.position(0); GL11 gl11 = (GL11)gl; int[] buffer = new int[1]; gl11.glGenBuffers(1, buffer, 0); vertexBufferIndex = buffer[0]; gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, 12 * 4, mVertexBuffer, GL11.GL_STATIC_DRAW); gl11.glGenBuffers(1, buffer, 0); normalBufferIndex = buffer[0]; gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, normalBufferIndex); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, 12 * 4, mNormalBuffer, GL11.GL_STATIC_DRAW); gl11.glGenBuffers(1, buffer, 0); textureBufferIndex = buffer[0]; gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureBufferIndex); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, texCoords.length * 4, mTexBuffer, GL11.GL_STATIC_DRAW); gl11.glGenBuffers(1, buffer, 0); indexBufferIndex = buffer[0]; gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indexBufferIndex); gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, 4 * 2, mIndexBuffer, GL11.GL_STATIC_DRAW); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0); } public float getWidth(){ return width; } public float getHeight(){ return height; } protected int loadTexture(GL10 gl, int resourceId){ texture = new int[1]; gl.glGenTextures(1, texture, 0); gl.glBindTexture(GL10.GL_TEXTURE_2D, texture[0]); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR); gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR); InputStream is = mContext.getResources().openRawResource(resourceId); Bitmap bitmap; try { bitmap = BitmapFactory.decodeStream(is); } finally { try { is.close(); } catch(IOException e) { // Ignore. } } ByteBuffer bb = extract(bitmap); gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, bitmap.getWidth(), bitmap.getHeight(), 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, bb); bitmap.recycle(); return texture[0]; } public void draw(GL10 gl, float angle, float x, float y) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glPushMatrix(); gl.glTranslatef(x, y, 0f); gl.glRotatef(angle, 0.0f,0.0f, 1.0f); gl.glBindTexture(GL10.GL_TEXTURE_2D, texture[0]); GL11 gl11 = (GL11)gl; gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex); gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, textureBufferIndex); gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, indexBufferIndex); gl11.glDrawElements(GL11.GL_TRIANGLE_STRIP, mNrOfVertices, GL11.GL_UNSIGNED_SHORT, 0); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0); gl11.glPopMatrix(); } private static ByteBuffer extract(Bitmap bmp) { ByteBuffer bb = ByteBuffer.allocateDirect(bmp.getHeight() * bmp.getWidth() * 4); bb.order(ByteOrder.BIG_ENDIAN); IntBuffer ib = bb.asIntBuffer(); // Convert ARGB -> RGBA for (int y = bmp.getHeight() - 1; y > -1; y--) { for (int x = 0; x < bmp.getWidth(); x++) { int pix = bmp.getPixel(x, bmp.getHeight() - y - 1); int alpha = ((pix >> 24) & 0xFF); int red = ((pix >> 16) & 0xFF); int green = ((pix >> 8) & 0xFF); int blue = ((pix) & 0xFF); // Make up alpha for interesting effect //ib.put(red << 24 | green << 16 | blue << 8 | ((red + blue + green) / 3)); ib.put(red << 24 | green << 16 | blue << 8 | alpha); } } bb.position(0); return bb; } private int vertexBufferIndex; private int textureBufferIndex; private int indexBufferIndex; private int normalBufferIndex; private float width; private float height; private int texture[]; private ShortBuffer mIndexBuffer; private FloatBuffer mVertexBuffer; private FloatBuffer mTexBuffer; private FloatBuffer mNormalBuffer; private int mNrOfVertices = 0; private Context mContext; }