1 package com.intel.realsense.librealsense;
3 import android.graphics.Rect;
4 import android.opengl.GLES10;
6 import java.nio.ByteBuffer;
7 import java.nio.ByteOrder;
8 import java.nio.IntBuffer;
20 mTexture = frame.
clone();
22 public int getTexture() {
return mGlTexture.array()[0]; }
26 if(colorArray != null){
27 ByteBuffer tex = ByteBuffer.allocateDirect(colorArray.length);
28 tex.order(ByteOrder.nativeOrder());
32 GLES10.glEnableClientState(GLES10.GL_COLOR_ARRAY);
33 GLES10.glColorPointer(4, GLES10.GL_UNSIGNED_BYTE, 0, tex);
36 ByteBuffer ver = ByteBuffer.allocateDirect(verArray.length * 4);
37 ver.order(ByteOrder.nativeOrder());
38 ver.asFloatBuffer().put(verArray);
40 GLES10.glEnableClientState(GLES10.GL_VERTEX_ARRAY);
41 GLES10.glVertexPointer(3, GLES10.GL_FLOAT, 0, ver);
42 GLES10.glDrawArrays(GLES10.GL_POINTS,0,verArray.length / 3);
44 GLES10.glDisableClientState(GLES10.GL_VERTEX_ARRAY);
45 if(colorArray != null)
46 GLES10.glDisableClientState(GLES10.GL_COLOR_ARRAY);
57 GLES10.glMatrixMode(GLES10.GL_PROJECTION);
58 GLES10.glPushMatrix();
59 GLES10.glLoadIdentity();
61 GLES10.glOrthof(1
f, -1
f, -1
f, 1
f, -7
f, 0
f);
63 GLES10.glRotatef(180, 0.0
f, 0.0
f, 1.0
f);
64 GLES10.glRotatef(-mDeltaY * mRotationFactor, 1.0
f, 0.0
f, 0.0
f);
65 GLES10.glRotatef(mDeltaX * mRotationFactor, 0.0
f, 1.0
f, 0.0
f);
72 GLES10.glMatrixMode(GLES10.GL_PROJECTION);
78 int size = data.length / 3;
81 float z = data[
i * 3 + 2];
83 for(
int j = 0;
j < 3;
j++)
85 texture[
i*4+3] = (
byte) 255;
98 byte[] textureData =
new byte[textureSize * 3];
105 for(
int i = 0;
i < pointCount;
i++){
106 if(pointsData[
i * 3 + 2] == 0)
108 float x = (float) Math.round(textureCoordinates[2 *
i] * w);
109 float y = (float) Math.round(textureCoordinates[2 *
i + 1] * h);
112 long texIndex = (long) (x + y * w);
113 for(
int j = 0;
j < 3;
j++)
114 texture[
i*4+
j] = textureData[(
int) (texIndex * 3 +
j)];
115 texture[
i*4+3] = (
byte) 255;
124 if(mGlTexture != null)
125 GLES10.glDeleteTextures(1, mGlTexture);
129 public synchronized void rotate(
float deltaX,
float deltaY) {
synchronized void close()
synchronized void setTextureFrame(Frame frame)
synchronized void draw(Rect rect)
synchronized void rotate(float deltaX, float deltaY)
GLdouble GLdouble GLdouble w
GLfloat GLfloat GLfloat GLfloat h
void drawPoints(float[] verArray, byte[] colorArray)
static void setViewport(Rect r)
void getData(byte[] data)
byte[] createTexture(float[] data, float maxRange)
float[] getTextureCoordinates()
byte[] createTexture(Points points)
boolean is(Extension extension)
GLdouble GLdouble GLint GLint const GLdouble * points