Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Pot Noodle on January 08, 2012
-
Raizor did ever manage to sort your Opengl Sine/3D problem out ?
I am trying to create a sinus scroller using Opengl my self, the 3D effect is not important but having the letters them self's
flex in a sine wave not just up and down, if you can let me know if you managed it and how.
Thanks
-
I kinda did. I went for a halfway house solution in the end.
I used a quad (opengl square) per character and used a sine value to offset each corner of the quad. The other way to do it would be using textured lines to make up the characters and offset the position of those, that would look smoother but would incur a performance penalty as there's more stuff to draw.
What I was working on was a wobbly page of text rather than a scroller. Using the offset quads method for a scroller might look a bit crap. The other option is to draw the scroller first to an FBO (framebuffer object, essentially just an offscreen rendering surface or texture you can draw to) and using the to texture a sine distorted polygon. FBOs are a bit complicated at first, so that may be something for later.
I'm not sure if that's enough info to get you going. If not, upload your project (or email to "raizor at gmail dot com") and I'll hopefully have time to look at it this evening. I'm assuming this is in Blitz? I'll have to grab a copy.
-
Yes thanks Raizor, I will email my code to you but first best I tidy it up a bit.
Thanks
-
Pot Noodle
Please find attached a couple of examples:
".Scroller.bmx"
This is your original version, changed a bit. I've left it using your glTranslate character positioning method, which limits the waviness of the scroller a bit. I've added a couple of bits for texturing and colouring the text.
".Scroller2.bmx"
Similar to the first version, but uses X/Y offsets for positioning the characters rather than glTranslate. This is a more flexible way of doing things and allows us to generate a smoother scroller. I've added a few "things to maybe try next" notes in the source that you may want to have a look into.
Both versions have quite a few code comments, so you should be able to follow what's going on. Please gimme a shout if anything isn't clear.
This is the first time I've used BlitzMax. I quite enjoyed it :)
Cheers,
Raizor
-
Thanks Raizor I am glad you enjoyed Blitz, Having ran your code I found that after a couple of scrolls my FPS slowed right down to a stand still, had to Ctrl + Tab back to Blide ide and close the program, But I like the way you made it look like a proper scroller of witch I have been trying to do for some time now, I will play with it and see what materializes.
Thanks again mate.
:goodpost: