PDA

View Full Version : Newspaper



philroc
11-01-2010, 09:34 AM
Hello,

has anyone ever created a flippable newspaper or book in OpenGL, such as the Flash-animations which you can see on the Web?
If so, did you use some kind of skeleton for the pages?
Are there any OpenGL classes or API available which allow to create flippable objects?
Many thanks.

Zyx_2000
11-01-2010, 12:43 PM
This shouldn't be too hard to accomplish. You need to render 2 quads (or 2*2 triangles in OpenGL3). If you flip between page 2-3 and 4-5, you do it like this; First you render a quad containing page 2 and 5 next to each other. Then you render a quad containing page 3 ON TOP OF page 5. Then, for each frame, you move the right edge of the last quad to the left. If the left edge of the book is at -1.0, the middle at 0.0, and the right edge is at 1.0, then the right edge of the page 3 quad should be at Cos(Pi*t/T), where t is the time elapsed since the first frame, and T is the total time of the flipping sequence. When t = T/2, you just render page 4 instead of page 3. This all is assuming that the book is viewed from up, but any perspective transformation can be applied as usual.

philroc
11-02-2010, 03:50 PM
Many thanks, Zyx_2000.