Android Open Source - glvideoplayer-android Nico Comment Plane






From Project

Back to project page glvideoplayer-android.

License

The source code is released under:

Apache License

If you think the Android project glvideoplayer-android 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

package net.binzume.android.glvideoplayer;
/* w  w  w . j  a v  a2  s .c om*/
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import android.annotation.TargetApi;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.opengl.GLES20;
import android.os.Build;
import android.view.Surface;

public class NicoCommentPlane extends OESTexture {
  private FloatBuffer vertex;
  
  private Surface surface;
  
  @TargetApi(Build.VERSION_CODES.KITKAT)
  public NicoCommentPlane() {
    

    try {
      
      textureUpdated = false;
      surfaceTexture = createSurfaceTexture();
      //surfaceTexture.attachToGLContext(textureName);
      surfaceTexture.setDefaultBufferSize(1024, 1024);
      surface = new Surface(surfaceTexture);
    } catch (RuntimeException e) {
      e.printStackTrace();
    }
    
    ByteBuffer bb = ByteBuffer.allocateDirect(4 * 4 * 4);
    bb.order(ByteOrder.nativeOrder());
    vertex = bb.asFloatBuffer();
    
    vertex.position(0);

    float bottom = 0f;
    float left = 0f;
    float sz = 1f;
    
    vertex.put(left);
    vertex.put(bottom);
    vertex.put(0);
    vertex.put(1);

    vertex.put(left);
    vertex.put(bottom + sz);
    vertex.put(0);
    vertex.put(0);

    vertex.put(left + sz);
    vertex.put(bottom + sz);
    vertex.put(1);
    vertex.put(0);

    vertex.put(left + sz);
    vertex.put(bottom);
    vertex.put(1);
    vertex.put(1);

    vertex.position(0);

  }
  
  public void draw() {
    Canvas canvas = surface.lockCanvas(null);
    
    canvas.drawColor(0x000000);
    // Log.d("draw", "w:"+canvas.getWidth() + ",h:" + canvas.getHeight());
    
    Paint paint = new Paint();
    paint.setColor(0x22FF0F00);  // **A*GGBB
    paint.setTextSize(50);

    canvas.drawText("???????????????", 400, 200, paint);
    canvas.drawText("??????????????????????????????????????????????????????", 200, 300, paint);
    canvas.drawText("????????", 100, 350, paint);
    
    surface.unlockCanvasAndPost(canvas);
    // Log.d("","draw" + textureName);
  }
  
  @Override
  public void bindBuffer(GLShaderProgram glsl) {
    GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureName);


    GLES20.glEnableVertexAttribArray(glsl.positionHandle);
    vertex.position(0);
    GLES20.glVertexAttribPointer(glsl.positionHandle, 4, GLES20.GL_FLOAT, false, 0, vertex);
//    checkGlError("drawGLES20 VertexAttribPointer bg vertex");
    

    // GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureName);
    
    //Log.d("","bindBuffer" + textureName);
  
  }
  
  @Override
  public void release() {
    if (surface != null) {
      surface.release();
      surface = null;
    }
    super.release();
  }

}




Java Source Code List

net.binzume.android.glvideoplayer.DeviceCameraPlane.java
net.binzume.android.glvideoplayer.FBOTexture.java
net.binzume.android.glvideoplayer.GLShaderProgram.java
net.binzume.android.glvideoplayer.GLVideoRenderer.java
net.binzume.android.glvideoplayer.MainActivity.java
net.binzume.android.glvideoplayer.MediaPlayerPlane.java
net.binzume.android.glvideoplayer.NicoCommentPlane.java
net.binzume.android.glvideoplayer.OESTexture.java
net.binzume.android.glvideoplayer.TextureFactory.java
net.binzume.android.glvideoplayer.Texture.java
net.binzume.android.glvideoplayer.VideoSurfaceView.java
net.binzume.android.nicoplayer.player.CommentController.java
net.binzume.android.nicoplayer.player.CommentLoadTask.java
net.binzume.android.nicoplayer.player.CommentSlot.java
net.binzume.android.nicovideo.ChannelCategoryInfo.java
net.binzume.android.nicovideo.ChannelInfo.java
net.binzume.android.nicovideo.Comment.java
net.binzume.android.nicovideo.MyList.java
net.binzume.android.nicovideo.NicoSession.java
net.binzume.android.nicovideo.ThreadInfo.java
net.binzume.android.nicovideo.VideoFileInfo.java
net.binzume.android.nicovideo.VideoInfo.java
net.binzume.android.nicovideo.util.HtmlUtil.java
net.binzume.android.nicovideo.util.HttpClient.java
net.binzume.android.nicovideo.webapi.ChannelAPI.java
net.binzume.android.nicovideo.webapi.CommentAPI.java
net.binzume.android.nicovideo.webapi.Constants.java
net.binzume.android.nicovideo.webapi.FriendListAPI.java
net.binzume.android.nicovideo.webapi.LoginAPI.java
net.binzume.android.nicovideo.webapi.MyListAPI.java
net.binzume.android.nicovideo.webapi.NotLoginException.java
net.binzume.android.nicovideo.webapi.PaymentRequiredException.java
net.binzume.android.nicovideo.webapi.VideoAPI.java
net.binzume.android.nicovideo.webapi.VideoRssParser.java
net.binzume.android.nicovideo.webapi.VideoSearchAPI.java
net.binzume.android.nicovideo.webapi.WatchItemAPI.java
net.binzume.android.nicovideo.webapi.WebApiException.java