Revision f203ffa0
Added by Leszek Koltunski over 3 years ago
| src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java | ||
|---|---|---|
| 57 | 57 |
{
|
| 58 | 58 |
public static final float BRIGHTNESS = 0.333f; |
| 59 | 59 |
private static final int DURATION = 1000; |
| 60 |
private static final int FBO_SIZE = 100; |
|
| 61 | 60 |
|
| 62 | 61 |
static final int COLOR_DEFAULT = 0xffffff55; |
| 63 | 62 |
static final int COLOR_MARKED = 0xffff0000; |
| ... | ... | |
| 110 | 109 |
private DistortedFramebuffer mFramebuffer; |
| 111 | 110 |
private String mPath; |
| 112 | 111 |
|
| 113 |
private int sW, sH; |
|
| 114 |
|
|
| 115 | 112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 116 | 113 |
|
| 117 | 114 |
BandagedCreatorRenderer(BandagedCreatorView v) |
| ... | ... | |
| 235 | 232 |
|
| 236 | 233 |
if( mSaveIcon>=0 ) |
| 237 | 234 |
{
|
| 238 |
if( mSaveIcon==0 ) renderIcon(time);
|
|
| 239 |
mSaveIcon++; |
|
| 235 |
renderIcon(time); // for some reason we need to call render() twice here, otherwise the
|
|
| 236 |
mSaveIcon++; // icon turns out black. Probably some problem with binding the texture.
|
|
| 240 | 237 |
} |
| 241 | 238 |
if( mSaveIcon>=2 ) |
| 242 | 239 |
{
|
| ... | ... | |
| 265 | 262 |
mScreen.attach(node); |
| 266 | 263 |
} |
| 267 | 264 |
|
| 268 |
sW = width; |
|
| 269 |
sH = height; |
|
| 270 |
|
|
| 271 | 265 |
mScale.set( mScaleValue,mScaleValue,mScaleValue ); |
| 272 | 266 |
mView.setScreenSize(width,height); |
| 273 | 267 |
mScreen.resize(width,height); |
| ... | ... | |
| 445 | 439 |
|
| 446 | 440 |
private void setupIconCreation(Activity act) |
| 447 | 441 |
{
|
| 448 |
TwistyObject object = new TwistyBandagedGeneric(ShapeHexahedron.DEFAULT_ROT, 0.9f, TwistyObject.MODE_ICON); |
|
| 442 |
final float R=1.0f; |
|
| 443 |
final int FBO_WIDTH = (int)(R*240); |
|
| 444 |
final int FBO_HEIGHT = (int)(R*360); |
|
| 445 |
final float OBJECT_SIZE = R*0.38f; |
|
| 446 |
|
|
| 447 |
TwistyObject object = new TwistyBandagedGeneric(ShapeHexahedron.DEFAULT_ROT, OBJECT_SIZE, TwistyObject.MODE_ICON); |
|
| 449 | 448 |
DistortedEffects effects = object.getObjectEffects(); |
| 450 | 449 |
DistortedNode node = object.getNode(); |
| 451 | 450 |
|
| 452 | 451 |
if( mFramebuffer==null ) |
| 453 | 452 |
{
|
| 454 |
mFramebuffer = new DistortedFramebuffer(sW,sH,1, InternalOutputSurface.DEPTH_NO_STENCIL);
|
|
| 455 |
mFramebuffer.glClearColor(BRIGHTNESS, BRIGHTNESS, 0.0f, 1.0f);
|
|
| 453 |
mFramebuffer = new DistortedFramebuffer(FBO_WIDTH,FBO_HEIGHT,1, InternalOutputSurface.DEPTH_NO_STENCIL);
|
|
| 454 |
mFramebuffer.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
|
|
| 456 | 455 |
} |
| 457 | 456 |
|
| 458 | 457 |
mFramebuffer.detachAll(); |
Also available in: Unified diff
Create the bandaged 3x3 icon: works now.