Author Topic: Re: 3D Text in OpenGL  (Read 3426 times)

0 Members and 1 Guest are viewing this topic.

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: 3D Text in OpenGL
« 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

 

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Re: 3D Text in OpenGL
« Reply #1 on: January 08, 2012 »
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.
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Re: 3D Text in OpenGL
« Reply #2 on: January 08, 2012 »
Yes thanks Raizor, I will email my code to you but first best I tidy it up a bit.
Thanks

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Re: 3D Text in OpenGL
« Reply #3 on: January 08, 2012 »
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
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: 3D Text in OpenGL
« Reply #4 on: January 09, 2012 »
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:
« Last Edit: January 09, 2012 by Pot Noodle »