Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

split the image into a mesh of small quadrangles in OpenGLES

How do I split the image into a mesh of small quadrangles in OpenGLES.

I need to split image in small parts and after that stretch only one part of the image, not the whole image.

Is it possible using OpenGL? I am new in OpenGL.

before editing in hair image like

before editing in hair image like

and after editing hair image like
and after editing hair image like

So the image stretches from any side and in any way.

like image 834
DharaParekh Avatar asked Mar 29 '13 10:03

DharaParekh


1 Answers

Can you explain more detailed? What quadrangles would you like to use? Are they simple rectangles or squares? Or they are a bit more complicated like parallelogram, trapezoid, kite or rhombus?

Anyway it's easy to split an image into any quadrangles you want. You can get any quadrangle from your image by telling OpenGL about image coordinates: glTexCoord2f(x, y)

I forgot to mention that image in OpenGL is loaded with size (1.f, 1.f) and it doesn't matter what size your picture is you can split it in as many as you want quadrangles.

There is one very useful tutorial about texture mapping maybe there you get your answers more detailed. Also i recommend you to keep an eye on official OpenGL documentation.

Good luck.

like image 164
Gintaras Dreižas Avatar answered Oct 05 '22 23:10

Gintaras Dreižas