iOS Rubber Image

iOS Rubber Image

Released 6 years ago , Last update 6 years ago

An OpenGLES1 rubber image manipulation component in C++ with Objective-C example for iOS.

This rubber image component provides a fullscreen textured mesh, similar to what is found in apps like FaceGoo and FatBooth.

It sets up a regular grid of physical points, and maps a texture onto it. Each point has a position, velocity and a rest position. User interaction modifies the velocities of the points, and elastic forces try to pull the point back to its rest position. There are no forces between adjacent points so it is extremely fast.

For this iOS example, the setup code and texture loading are written in Objective C, but the pertinent code is C++, so it is very portable and can be compiled for almost any system.

In addition, it uses OpenGLES 1, making it compatible with all devices.

Pricing

14 day 14-day money-back guarantee

$99.99

Application License

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Commercial use

Documentation

This is the source code for a rubber image, similar to what is found in apps like FaceGoo and FatBooth.

It sets up a regular grid of physical points, and maps a texture onto it. Each point has a position, velocity and a rest position. Use interaction modifies the velocities of the points, and elastic forces try to pull the point back to its rest position. There are no forces between adjacent points so it is extremely fast.

For this iOS example, the setup code and texture loading are written in Objective C, but the pertinent code is C++, so it is very portable and can be compiled for almost any system.

In addition, it uses OpenGLES 1, making it compatible with all devices.

The onscreen sliders control the elasticity and damping.

Try these values:

Elasticity = 0%, Damping = 100%  - Smear the image like in FaceGoo (plastic behaviour)
Elasticity = 100%, Damping = 0%  - Jelly image that never stops wobbling (elastic behaviour)

In the code you will find two classes:

  • v2 is a useful 2D vector class with overloaded operators.
  • RubberImage creates an array of physical points and creates a triangle mesh, using GL_TRIANGLE_STRIP for greatest speed.

To include in your own app:

1) Copy v2.h, v2.cpp, RubberImage.h and RubberImage.cpp to your own project.

2) Make sure you have an OpenGL canvas with proper view matrices and rendering states.

at initialisation

3) Create a RubberImage object

RubberImage *myRubberImage = new RubberImage();

4) Initialise it

myRubberImage->init( NUMBER_OF_HORIZONTAL_GRID_POINTS, NUMBER_OF_VERTICAL_GRID_POINTS, SCALE_OF_GRID );

5) Load and set the texture

myRubberImage->setTextureHandle( TEXTURE_HANDLE );

6) Set the elasticty and damping

myRubberImage->setElasticity( ELASTICITY_VALUE ); 
myRubberImage->setDamping( DAMPING_VALUE  );

every frame

7) Apply perturbations

myRubberImage->applySmudgeForce( TIMESTEP, POSITION, VELOCITY, RADIUS );

8) Update the mesh

myRubberImage->update( TIMESTEP );

9) Draw the mesh

myRubberImage->draw();

to clean up

10) Delete the object

delete myRubberImage;
2 licenses, starting from From » $99.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • WJ Wang Jin 2 years ago
    Hi, I am using opengel es2.0 in my project. Can I use iOS Rubber Image in my project?, In case of developer license, Can I get the full source code? Regards.
  • MV mandeep vohra 4 years ago
    hii i have purchased your sdk .it works fine but i am not able to convert into image format for sharing on facebook,twitter,blogs . it returns a black image please kindly help me so i can get a proper worth of my money please it would be a kind help
  • R Robert 5 years ago
    Hi, I have a wine label format (for example http://www.bedetheque.com/ParaBD/17556etiquetteDeVinCoteauxDuLayon19971_29042009_170701.jpg), and I would like distorde on a bottle, is it possible? Thanks for your response