Can glscissor clip multiple area? - ios

i am stucked in a problem and looking for help here.
I want to clip the screen, only part of the screen can be displayed. I used glscissor and met a problem. It seems like glscissor can only difine ONE rectangle on the screen, but i hava to display multiple areas at the same time, can anyone tell me how to do?
thanks.
forgive my poor english

The scrissor is limited to one rectangle, indeed. If you want to clip to multiple rectangles, you can either draw everything once per clip-rectangle, or use the stencil buffer to mask the different areas.

Related

Square Cash Label Animation

Does anyone know how Square Cash animates their label?
The label does two things, appears to resize to fit the numbers on screen like SizeToFit might, but I don't believe that you can animate based on SizeToFit.
Secondly, numbers that disappear seem to animate downwards and disappear. Numbers that are entered animate down from above. That doesn't seem too tricky, but the comma does it too when we go from 4 digits to 5 digits!
I coded something similar and yes, it is very tricky to make it perfect.
It may help you to know that I used collection views. Then you can customise cell/layout transitions.
Hope this helps.
It would be helpful if you posted a short video so we could see the animation you are talking about.
Based on your description, I'm guessing that they build the full number themselves by putting a single digit/symbol on a layer (or view) and then animating each character separately.
If you have a separate tile for each symbol it is pretty easy to change the size of the previous tiles to make room for a new tile, and animate a new number tile down at the same time. You could do the animation with UIView animation or with a set of coordinated CABasicAnimations.
I know the answer is late but may be help to some other,
I developed demo screen similar to square cash you can check here

Render water-paint in iOS

I have been working with OpenGL in iOS, and setting the colors with glColor4f(r,g,b,a) and then drawing my own color on a white UIImageView. I basically have a brush, which is then moved around my user's touch, and then it paints the color onto the canvas. But this color needs to be water paint (like smudged color)
Does anyone understand/knows how to get a water color like this app does, and how the background UIImageView has a texture on it?
https://itunes.apple.com/us/app/hello-watercolor/id539414526?mt=8
or checkout water paint in this. http://www.fiftythree.com/paper
I created a bounty on this as I am really having a hard time to grasp how to derive such smooth flowing colors out of the normal colors. Even if you guys point me in the right direction, or to some sample code on how I can get the effect of water-paint, it would be really helpful ^_^
And as a bonus, it would be also be helpful if you can point out to me how to get canvas on which it is painted on looks realistic, and blended with the paint? Does Blending/GLSL have to do with any of this?
Is there any sample project on this?
If you are still struggling with the basics of getting realistic looking water colors working, you may want to experiment/prototype in photoshop first.
http://www.zoepiel.com/tutorials/watercolor/ shows some very effective tricks for creating watercolor images with simple tools.
The most interesting one is to multiply a group of watercolor layers with a greyscale watercolor paper image. The texture of the paper makes some parts remain white, and other parts saturate with color, just like real watercolor.
Each layer remains 'wet' in the sense that the colors within it blend, but the layers are 'dry' with respect to each other.
She also explains some of her brush and blur settings and shows what they do.
Once you can produce the desired effect in photoshop, you'll have clear specifications of what you want to do and you'll be quite a bit closer to programming it out.
Looking at the examples you posted, it looks like they are using a simple Gaussian Blur with a radius of double your brush size. This may be an incomplete solution, but it's at least the first level.

Detecting if user draws over given line

I want to make a little iphone game where the User has to draw over a given line in a image. I know how to do the drawing code when the user touches the screen. But I have no clue how I can detect when the drawn line(s) are for example 95% over a given line in a png image.
An example of this is in the free 'dumb ways to die'-iphone/ipad game. The mini-game where you have to feed the snake by putting mustard on a hotdog.
Tips on how you would solve this problem are very welcome!
Thanks!
The easiest would probably be to have a secondary (invisible) image of the same size that contains just the line, but with a thicker stroke. You could then simply check the pixel color in that secondary image for all the points of the line that is drawn by the user.

Image processing - Music note blocks detection

I have a music note sheet (like this for example)
, I want to detect the position of each block in it and then detect the vertical lines that split it, To be like this.
Can you help me how can I do this ?
Thanks in advance
You can use a Hough transform to detect lines in the image. For horizontal ones this should give you five at a time which are the staves and vertical ones may need a bit more processing to figure out what are stems and what are bar lines.

OpenGL ES: Drawing small objects

To best illustrate the issue I'm having, I created a short screen grab. Watch it here: http://cl.ly/1o3p3x2e2J1a1d3d2N1Q
Basically, the stars on the screen, as they're animated across the screen from right to left, are dimming and brightening on their own. I'm not intending on this happening. When you zoom in, the issue disappears.
My hunch is that this has to do with the size of the objects being drawn and the pixel boundaries. Is this correct? What is the best way to go about fixing this issue?
Thanks!
---Edit---
Here's how I'm loading the texture: http://pastebin.com/RDc8x7Te
And, here's how I'm setting up OpenGL ES: http://pastebin.com/SpvAqPqA
You use nearest and linear for scaling textures, which are both not very accurate. You might want to use linear for both, or build mipmaps. Also in case you use an orthogonal view, try aligning your geometry on pixels.

Resources