Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scroll Text on TV

117 views
Skip to first unread message

Jovo Mirkovic

unread,
May 8, 2003, 9:41:57 AM5/8/03
to

Hi,

I need advice, according display scrolling text on TV.
What is the best solution?
We try move label, with timer - to slow...
We try BitBlt - we have a flicking...
With DirectX, similar situation...

What is the right solution?

Thanks,

Jovo


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Armin Zingler

unread,
May 8, 2003, 10:55:14 AM5/8/03
to
"Jovo Mirkovic" <yo...@sezampro.yu> schrieb

> I need advice, according display scrolling text on TV.
> What is the best solution?
> We try move label, with timer - to slow...
> We try BitBlt - we have a flicking...
> With DirectX, similar situation...
>
> What is the right solution?

Smooth realtime scrolling (attention: quick&dirty solution):

Private Sub Form1_Activated( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Activated

Static done As Boolean

If Not done Then
Const Text As String = "Scrolling"

Dim Backbuffer As Bitmap
Dim gBack, gFront As Graphics
Dim StartTick As Integer
Dim size As SizeF

done = True
Me.Font = New Font("Arial", 30, FontStyle.Bold)
Backbuffer = New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
gBack = Graphics.FromImage(Backbuffer)
gFront = Me.CreateGraphics
size = gBack.MeasureString(Text, Me.Font)
StartTick = Environment.TickCount

Do
'Render
Dim pos As PointF
Dim x, y As Single
Dim Duration As Integer

Duration = Environment.TickCount - StartTick

x = (Me.ClientSize.Width - size.Width) / 2.0F
y = Me.ClientSize.Height - Duration / 20.0F
If y < -size.Height Then StartTick = Environment.TickCount
pos = New PointF(x, y)
gBack.Clear(Color.Black)
gBack.DrawString(Text, Me.Font, Brushes.White, pos)

'Flip
gFront.DrawImageUnscaled(Backbuffer, 0, 0)

Application.DoEvents()
Loop While Me.Visible

gBack.Dispose()
gFront.Dispose()
End If
End Sub


--
Armin

Armin Zingler

unread,
May 8, 2003, 2:33:36 PM5/8/03
to
Of course I tried this.
2fps? On a P75 without hardware acceleration? ;-)

I've done some small (flickerfree) animations using this technique and GDI
in VB6 but always got much higher rates (700MHz+Geforce 1). Maybe rendering
was not very fast, but Bitblt ("flipping") was not noticable slow.

I'm getting 44 FPS here. Clientsize: 920x672 (XP1600+, GF4Ti4200). Below the
changed code, now displaying FPS.

I don't know why/if it's flickering on TV. Wouldn't be a programming issue,
I guess... So, not my problem. :)


Armin

Private Sub Form1_Activated( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Activated

Static done As Boolean

If Not done Then
Const Text As String = "Scrolling"

Dim Backbuffer As Bitmap
Dim gBack, gFront As Graphics

Dim StartTick, FPSTick As Integer
Dim size As SizeF
Dim FPSFont As New Font("Courier New", 10)
Dim FPSText As String
Dim FPSCounter As Integer

done = True
Me.Font = New Font("Arial", 30, FontStyle.Bold)
Backbuffer = New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
gBack = Graphics.FromImage(Backbuffer)
gFront = Me.CreateGraphics
size = gBack.MeasureString(Text, Me.Font)
StartTick = Environment.TickCount

Do
Dim f2 As Form1


'Render
Dim pos As PointF
Dim x, y As Single

Dim Duration, FPSDuration As Integer
Dim Ticks As Integer

Ticks = Environment.TickCount

Duration = Ticks - StartTick

x = (Me.ClientSize.Width - size.Width) / 2.0F
y = Me.ClientSize.Height - Duration / 20.0F
If y < -size.Height Then StartTick = Environment.TickCount
pos = New PointF(x, y)
gBack.Clear(Color.Black)
gBack.DrawString(Text, Me.Font, Brushes.White, pos)

gBack.DrawString(FPSText, FPSFont, Brushes.White, 0, 0)

'Flip
gFront.DrawImageUnscaled(Backbuffer, 0, 0)

'FPS
FPSCounter += 1
FPSDuration = Ticks - FPSTick
If FPSDuration >= 1000 Then
FPSText = (FPSTick / FPSDuration / 1000).ToString("0.0")
FPSTick = Ticks
FPSCounter = 0
End If

Armin Zingler

unread,
May 9, 2003, 9:42:34 AM5/9/03
to
:)

1. Today I started it again: 13.5 FPS. 8-/ I didn't change anything.
Neither the code nor screen resolution or anything else.... It's 13.5 FPS,
no matter what form size I choose in design mode. Strange...

2. I set windowstate = maximized at design time and tested it (1280x1024
fullscreen). Nothing happened. Why? The Activated-Event did not occur!
Another bug?

Armin

"Jeremy" <thevis...@hotmail.com> schrieb
> I couldn't understand why your code was running so much faster
> than mine until I realized that in my code I using the Alpha
> channel. Blending my entire buffer @ 1024x768 is prolly not the
> best way to do it hehe.
>
> :)
>
>
>
> "Armin Zingler" <az.n...@freenet.de> wrote in message
> news:eqM2edfF...@tk2msftngp13.phx.gbl...

Jovo Mirkovic

unread,
May 9, 2003, 10:52:27 AM5/9/03
to

Thanks Armin,

but I still have a problem... I try this code, it is OK on the Monitor,
but is is not OK on the TV OUT... (I have a flicking...)

Jeremy

unread,
May 9, 2003, 10:59:59 AM5/9/03
to
Jovo,

Does anything else flicker on the TV? I have used TV-Out cards before, they always flicker like crazy.

Jeremy


"Jovo Mirkovic" <yo...@sezampro.yu> wrote in message news:eo$9cqjFD...@TK2MSFTNGP12.phx.gbl...

Armin Zingler

unread,
May 9, 2003, 10:57:24 AM5/9/03
to
"Jovo Mirkovic" <yo...@sezampro.yu> schrieb

> but I still have a problem... I try this code, it is OK on the
> Monitor, but is is not OK on the TV OUT... (I have a flicking...)

Why do you think you have a VB problem?


--
Armin

Armin Zingler

unread,
May 9, 2003, 11:23:22 AM5/9/03
to
"Jeremy" <thevis...@hotmail.com> schrieb
> I think they are still working out the kinks in GDI+. The best
> way to render full-screen graphics is to use DX9 or OpenGL
> (IMO).
>
> In regards to that, I was playing with the samples in the
> Dx9SDK, and the C++ samples run at 150 FPS while BG rendering
> and 160-190 FPS while in FG.
>
> The C# and VB Managed Samples run at 130-160 FPS while in FG,
> and at about 19 FPS while in BG.
>
> Although, I think this is because of the retarded way that the
> samples render - calling DoEvents every iteration. I would be
> interested to see the preformance improvement if the main
> rendering routine ran in its own thread.

I'm not looking for the fastest way. :) Just been playing around (fun).

Downloaded only the DXVB SDK (huge enough): Billboard sample @ 400x300:
300FPS in FG, 10FPS in BG. Getting a little OT now... ;-)

--
Armin

Armin Zingler

unread,
May 9, 2003, 10:59:57 AM5/9/03
to
"Armin Zingler" <az.n...@freenet.de> schrieb

"Tiny" correction:

replace


FPSText = (FPSTick / FPSDuration / 1000).ToString("0.0")

by
FPSText = (FPSCounter / FPSDuration * 1000).ToString("0.0")


8-/ he he he


Ok, now I'm getting realistic 270 FPS@256x256 and 18 FPS@1280x1024

(BTW, I'll never understand why it's smooth but sometimes jumping although
there's nothing relevant running in the background)

--
Armin

Jeremy

unread,
May 9, 2003, 12:55:39 PM5/9/03
to
> (BTW, I'll never understand why it's smooth but sometimes jumping although
> there's nothing relevant running in the background)

a service maybe (?)




"Armin Zingler" <az.n...@freenet.de> wrote in message news:e%23ioUAkF...@TK2MSFTNGP12.phx.gbl...

Armin Zingler

unread,
May 9, 2003, 1:58:03 PM5/9/03
to
"Jeremy" <thevis...@hotmail.com> schrieb

> > (BTW, I'll never understand why it's smooth but sometimes
> > jumping although there's nothing relevant running in the
> > background)
>
> a service maybe (?)


No, I measured the time per frame (the whole part between Do and Loop) for
some hundreds or thousands of frames, and all values are within a small
range. But when I look at it, it's not animated 100% fluently, not even at
300FPS. I've always wondered why - it also happened in VB6 and/or even when
using the high performance counter instead of TickCount.

Well, wrong group for a deeper discussion.

Armin

Jeremy

unread,
May 9, 2003, 2:39:48 PM5/9/03
to
If your talking about the DX samples, the awnser is in the loop. This is what I was talking about in my post earlier. It's because of the DoEvents, it causes the animation to get choppy if you move the mouse over the image because it has to take time awayfrom the render routine in order to process the messages coming from windows (eg WM_MouseMove etc...).

The Render routine should be in it's own thread. DoEvents is the problem, no doubt about it.

- J



"Armin Zingler" <az.n...@freenet.de> wrote in message news:O5Kx4SlF...@TK2MSFTNGP10.phx.gbl...

Armin Zingler

unread,
May 9, 2003, 3:43:15 PM5/9/03
to
No, I was talking about the code I posted.

Armin


"Jeremy" <thevis...@hotmail.com> schrieb im Newsbeitrag
news:UBSua.24087$ut.3...@twister.tampabay.rr.com...

Jovo Mirkovic

unread,
May 12, 2003, 4:20:45 AM5/12/03
to

Good question...
I think that is VB problem, because when I test environment with
DeCrawler (Mohave Desert Software) it works well...

Armin Zingler

unread,
May 12, 2003, 5:30:04 AM5/12/03
to
"Jovo Mirkovic" <yo...@sezampro.yu> schrieb

>
> Good question...
> I think that is VB problem, because when I test environment with
> DeCrawler (Mohave Desert Software) it works well...

And when you test on a monitor, you say, it works well => no VB problem, IMHO.


--
Armin

0 new messages