Revision 7e6110e2
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/fbo/FBORenderer.java | ||
|---|---|---|
| 46 | 46 |
class FBORenderer implements GLSurfaceView.Renderer |
| 47 | 47 |
{
|
| 48 | 48 |
private GLSurfaceView mView; |
| 49 |
private DistortedBitmap mLisa, mText;
|
|
| 49 |
private DistortedBitmap mLisa; |
|
| 50 | 50 |
private int lisaHeight, lisaWidth; |
| 51 | 51 |
|
| 52 | 52 |
private DistortedNode mRoot; |
| 53 | 53 |
|
| 54 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 55 | 55 |
|
| 56 |
public FBORenderer(GLSurfaceView v)
|
|
| 56 |
FBORenderer(GLSurfaceView v)
|
|
| 57 | 57 |
{
|
| 58 | 58 |
mView = v; |
| 59 | 59 |
} |
| ... | ... | |
| 122 | 122 |
lisaWidth = bitmap1.getWidth(); |
| 123 | 123 |
|
| 124 | 124 |
mLisa = new DistortedBitmap(bitmap1, 20); |
| 125 |
mText = new DistortedBitmap(bitmap2, 20);
|
|
| 125 |
DistortedBitmap text = new DistortedBitmap(bitmap2, 20);
|
|
| 126 | 126 |
|
| 127 | 127 |
mRoot = new DistortedNode(mLisa); |
| 128 |
mRoot.attach(mText);
|
|
| 128 |
mRoot.attach(text);
|
|
| 129 | 129 |
|
| 130 |
int textWidth = mText.getWidth();
|
|
| 131 |
int textHeight = mText.getHeight();
|
|
| 130 |
int textWidth = text.getWidth();
|
|
| 131 |
int textHeight = text.getHeight();
|
|
| 132 | 132 |
|
| 133 | 133 |
float factor = lisaWidth/(1.5f*textWidth); |
| 134 | 134 |
|
| 135 |
mText.move( new Static3D(lisaWidth/6,lisaHeight/3,0) );
|
|
| 136 |
mText.scale(factor);
|
|
| 135 |
text.move( new Static3D(lisaWidth/6,lisaHeight/3,0) );
|
|
| 136 |
text.scale(factor);
|
|
| 137 | 137 |
|
| 138 | 138 |
Dynamic1D sinkDyn = new Dynamic1D(5000,0.0f); |
| 139 | 139 |
sinkDyn.add(new Static1D(1.0f)); |
| 140 | 140 |
sinkDyn.add(new Static1D(0.5f)); |
| 141 | 141 |
|
| 142 |
mText.sink(sinkDyn, new Static2D(textWidth/2,textHeight/2));
|
|
| 142 |
text.sink(sinkDyn, new Static2D(textWidth/2,textHeight/2));
|
|
| 143 | 143 |
|
| 144 | 144 |
Dynamic1D chromaDyn = new Dynamic1D(10000,0.0f); |
| 145 | 145 |
chromaDyn.add(new Static1D(0.0f)); |
Also available in: Unified diff
Tidy up 'FBO'