Author Topic: Somthing Strange  (Read 4603 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
Somthing Strange
« on: July 18, 2011 »
Hi Guys,
Would some one with BlitzMax & Opengl knowledge take a look at my code please, there is two problems.
(1) scroller does not start at the place.
(2) FPS is all over the place, starts out ok then after a few Min's the FPS start to jump up & down.

Thanks

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Somthing Strange
« Reply #1 on: July 18, 2011 »
Hi Potnoodle :)

It starts where it does because there are no blank spaces padding the beginning of the scroll.  It runs at about 3fps for me - Usually it happens on this card because it's an ATI card and it's intollerant of non power of two textures, but this time I think it has something to do with you binding the textures of each letter as you draw it.

I'd think that it would be better to have the letters as one long strip and use some kind of calculated offset to generate the texture co-ordinates for your scroll.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Somthing Strange
« Reply #2 on: July 18, 2011 »
I was hoping not to have all them spaces in the text, Do you know of a way so the scroller will re start as soon as the last letter goes off screen  ;D please

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Somthing Strange
« Reply #3 on: July 18, 2011 »
I think it might be this GLTexFromPixmap that's slow and/or leaking memory.  Can you pre-calc that for all the letters outside the loop that prints the messages?

something like
Code: [Select]
for x = 32 to 127
letters[x] = GlTexFromPixmap(font[x])
next
then in your loop
Code: [Select]
font = letters[x]

Jim
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Somthing Strange
« Reply #4 on: July 18, 2011 »
I was hoping not to have all them spaces in the text, Do you know of a way so the scroller will re start as soon as the last letter goes off screen  ;D please

There are a few ways of doing that, here's some of them..

You could have a texture that you draw for the scroll each frame,  and just draw new letters on the right hand side of it every time you pass one letter width and simply draw this texture each frame.

or

You could have an array of letters that are displayed accross the screen, scroll an offset and when it goes further that the width of a letter, move them all over one place so the first becomes the second, the second becomes the third until you get to the end where the new one goes.


Finally (and probably useless for PC coding)
You could have a texture twice the width of a screen and scroll it the same amount each frame;

Code: [Select]
        | <- 1 Screen -> |
========================
 <<   |A        |B  <<
========================

have two points where you draw the letters (A+B), when you've scrolled one screen width, flip the screen back (a trick I used to use on the amiga with hardware scrolling under interrupt), because you have two copies of the scroll it will look like it's moving continuously.

All the above methods would do what you need.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Somthing Strange
« Reply #5 on: July 18, 2011 »
Thanks Jim your idea works, I didn't think it was GLTexFromPixmap I think I tried everything else  ::)
Now to get the scroll to draw all the text as it ends before the end of the scroll text.
Cheers Shockwave I will test your ideas and see.
Thanks guys.