Project

General

Profile

« Previous | Next » 

Revision c5369f1b

Added by Leszek Koltunski about 7 years ago

Major: change of API.

Split DFramebuffer into Framebuffer and Screen; introduce the 'DistortedInputSurface' and 'DistortedOutputSurface' interfaces.

View differences:

src/main/java/org/distorted/library/DistortedTexture.java
29 29
 * Class which represents a OpenGL Texture object.
30 30
 * <p>
31 31
 * Create a Texture of arbitrary size and feed some pixels to it via the setTexture() method.
32
 * <p>
33
 * Keep all objects created in a static LinkedList. The point: we need to be able to mark
34
 * Textures for deletion, and delete all marked objects later at a convenient time (that's
35
 * because we can only delete from a thread that holds the OpenGL context so here we provide a
36
 * framework where one is able to mark for deletion at any time and actual deletion takes place
37
 * on the next render).
38 32
 */
39
public class DistortedTexture extends DistortedRenderable
33
public class DistortedTexture extends DistortedRenderable implements DistortedInputSurface
40 34
  {
41 35
  private Bitmap mBmp= null;
42 36

  
......
61 55
///////////////////////////////////////////////////////////////////////////////////////////////////
62 56
// must be called from a thread holding OpenGL Context
63 57

  
64
  void create()
58
  public void create()
65 59
    {
66 60
    if( mBmp!=null && mColorH !=null )
67 61
      {
......
104 98
    {
105 99
    if( mColorH[0]!=DONT_CREATE ) mColorH[0] = NOT_CREATED_YET;
106 100
    }
101

  
107 102
///////////////////////////////////////////////////////////////////////////////////////////////////
108 103

  
109 104
  static void getUniforms(int mProgramH)
......
126 121
    mBmp= null;
127 122
    }
128 123

  
124
///////////////////////////////////////////////////////////////////////////////////////////////////
125
/**
126
 * Bind the underlying rectangle of pixels as a OpenGL Texture.
127
 */
128
  public boolean setAsInput()
129
    {
130
    if( mColorH[0]>0 )
131
      {
132
      GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, mColorH[0]);
133
      return true;
134
      }
135

  
136
    return false;
137
    }
138

  
129 139
///////////////////////////////////////////////////////////////////////////////////////////////////
130 140
/**
131 141
 * Sets the underlying android.graphics.Bitmap object.

Also available in: Unified diff