
Easy to live in the 21st century. It is even easier to get a video image from any of the iPhone cameras inside your application.
How to do it and how I did it, it was told in the
article about the fruit hothouse.
Imagination did not stop there.
These photos can be used in the three-dimensional world.
An example of a three-dimensional object with a flat picture on the side you see to the left of the text.
If you do not see the logo on the image of the vase, turn on the mode of
viewing pictures in your browser.
Below I will give an example of turning a flat image into a GL texture and tell you how I secretly spied on the
iOS Review Team .
')
I remind you that the
iOS Review Team is the people who check our applications for approval in the appStore.
Little code
To convert bitmap pictures to GL texture, one function is enough.
Function
uploadTexture- (GLuint) uploadTexture:(UIImage*) image { GLuint width = 256; GLuint height = 256; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); void *imageData = malloc( height * width * 4 ); CGContextRef ctx = CGBitmapContextCreate( imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big ); CGColorSpaceRelease( colorSpace ); CGContextClearRect( ctx, CGRectMake( 0, 0, width, height ) ); CGContextTranslateCTM( ctx, 0, height - height ); CGContextDrawImage( ctx, CGRectMake( 0, 0, width, height ), image.CGImage ); GLuint texName; glGenTextures(1, &texName); glBindTexture(GL_TEXTURE_2D, texName); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData); CGContextRelease(ctx); free(imageData);
An attentive reader will notice that I turn the picture upside down, which of course is not necessary.
Image orientation can also be done at the level of OpenGL functions, which is even simpler.
Potter's wheel
I immediately used the received code in my ancient Potter Circle application. Why in it?
The application brought me 5 bucks a day for 2 years, when suddenly (about a month ago) the flow of money stopped.
The application was primitive - you turn a potter's wheel. He is spinning, spinning.
And you drag your finger across the screen and deform the cylinder into a vase, glass or amphora in accordance with your artistic talent.
On the vase, you can stretch the picture and even paint it.
To understand what kind of trouble happened with the program, I had to look at the application page, and oh! I was terrified.
Rating zero! And the only comment hangs: -DON'T BUY THIS APP! It is not a potter's wheel! Wasting money!
Well, I think, competitors, Jews or mafia. Mario ciuda la finestra!
And you can not answer. Whether business in Google Play - be lit with users though to midnight.
That's why I do not go to the pages of my applications in the appStore and do not read reviews - my nerves go to hell, and health is more expensive.
The only way to remove a negative review is to release a new version .
If not, correct me.
New version with video capture
Made-said, released an update, screwing the above function, that is, began to pull the user's photo on the fly, sculpt on a vase online and at the same time hide on his server.
Laid out the application for verification. And for 20 long nights I followed the directory where the photographs of the checkers were to appear. Insolent! As felt a trick, three weeks neither hearing, nor spirit.
And yesterday, claps! Done, I got a man, pretty cute, young, about 30 years old, staring at my application and my iPhone.
And today, claps-2, the application is approved in the app!
For ethical reasons, the photo of the man (and the Brazilian from Una Frutta from the previous article) will not show anyone.
Jokes jokes, and no one bothers you to do the same trick in their programs.
These photos can be used in halls of fame, rating tables and lists of winners of daily championships.
I personally think of doing this in Chapa. The audience of the game for the six months settled down, they play the same 100-200 people and everyone (that is, me) is extremely curious about what the permanent pro-champions Slavyan74 or DimonSergeich or FabioHaddad from Brazil look like ... Perhaps there are among them masters.
Of course, do not forget to warn players about this feature of the application.
And analyze the pictures. Players because there is not only the person shoved.