473,797 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OpenGL Control Flickering Problem

I have a problem with my Visual Basic .NET 2003 application which I
have so far been unable to resolve.

I am trying to get an OpenGL control that I have created working
properly as a control on my main form in my VB.NET application. It does
work and render correctly but the problem is that there is an awful
flickering that happens on most PCs I try it on. The flickering is
reminiscent of the sort that you get on a TV when it is not tuned in
properly, i.e. portions of the background are visible in horizontal
bands that move up or down the control and make it pretty much
unusable.

Bizarrely though, on my laptop, if I Alt-Tab to another application
which moves in front of the flickering control and then Alt-Tab back to
my application then it is fine for a while. However, as soon as any
other dialog or message box appears in my application, or I resize it
then the flickering starts again. On two of my colleague's laptops
however, we get the flickering and no amount of moving things in front
of it makes any difference.

Also, when I remote desktop into my laptop from my PC, I do not see
this problem at all, i.e. the control behaves perfectly.

I am using an OpenGL wrapper library. I oringally tried using CsGL and
then I tried Tao (more recent and maintained library) for the control,
both have the same result.

The code I am using has a timer on the form which fires periodically to
force the refresh of the control. I have tried varying the periodicity
of this from 1ms right up to 1000ms but the flickering still happens.
With 1000ms it almost appears like as soon as the control is refreshed,
it disappears as with this periodicity it becomes almost invisible.

Does anyone have any ideas on this as it is driving me barmy now!

Thanks,

Mark.

May 10 '06 #1
6 3639
Hello Mark,

Probably you'll need to enable double buffering on your control during
its creation:

~
Me.SetStyle(Con trolStyles.Doub leBuffer, True)
Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
Me.SetStyle(Con trolStyles.User Paint, True)
~

Hope this helps,
Roman
May 11 '06 #2
Thanks Roman but I am pretty sure that's not it.

I probably should have mentioned that I had already eliminated lack of
Double Bufferring as the problem as I am already doing this. Also, it
isn't that sort of flickering that you get with the bufferring, it is
more like the entire control is disappearing every time it is
refreshed. It's just that I am refreshing so often that it is appearing
and disappearing several times a second.

Any further help from anyone would be appreciated.

Regards,

Mark.

May 11 '06 #3
You forgot to override OnPaintBackgrou nd so that it doesn't call the base
class didn't you... ;-)

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Mark Thompson" <ch****@dsl.pip ex.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
I have a problem with my Visual Basic .NET 2003 application which I
have so far been unable to resolve.

I am trying to get an OpenGL control that I have created working
properly as a control on my main form in my VB.NET application. It does
work and render correctly but the problem is that there is an awful
flickering that happens on most PCs I try it on. The flickering is
reminiscent of the sort that you get on a TV when it is not tuned in
properly, i.e. portions of the background are visible in horizontal
bands that move up or down the control and make it pretty much
unusable.

Bizarrely though, on my laptop, if I Alt-Tab to another application
which moves in front of the flickering control and then Alt-Tab back to
my application then it is fine for a while. However, as soon as any
other dialog or message box appears in my application, or I resize it
then the flickering starts again. On two of my colleague's laptops
however, we get the flickering and no amount of moving things in front
of it makes any difference.

Also, when I remote desktop into my laptop from my PC, I do not see
this problem at all, i.e. the control behaves perfectly.

I am using an OpenGL wrapper library. I oringally tried using CsGL and
then I tried Tao (more recent and maintained library) for the control,
both have the same result.

The code I am using has a timer on the form which fires periodically to
force the refresh of the control. I have tried varying the periodicity
of this from 1ms right up to 1000ms but the flickering still happens.
With 1000ms it almost appears like as soon as the control is refreshed,
it disappears as with this periodicity it becomes almost invisible.

Does anyone have any ideas on this as it is driving me barmy now!

Thanks,

Mark.

May 11 '06 #4
Bob Powell [MVP] wrote:
You forgot to override OnPaintBackgrou nd so that it doesn't call the base
class didn't you... ;-)


Hi Bob,

Thanks for your help but unfortunately that does not fix it.

I had really high hopes that that would be it when I saw your post but
I have just spent the last hour trying it out. I have tried overriding
it in my OpenGL control. I have tried overriding it in the main form. I
have even tried overriding it in a Custom Panel class that I have which
is substituted for all the panels on the main form in case this was the
problem but to no avail in all cases.

I feel it has to be something simple like this though.

Any other ideas?

Thanks,

Mark.

May 12 '06 #5
I think that the best thing to do is concentrate on your OpenGL control.
Everything else is just noise.

Have you set the styes for AllPaintingInWM Paint and UserPaint ?

How are you drawing the OpenGL rendering. To the screen or to a bitmap?
Are you using double-buffering?

Are you using CreateGraphics anywhere?

The OnPaintBackgrou nd call in the OpenGL control should look like:

protected void OnPaintBackgrou nd(PaintEventAr gs pe)
{
//Do nothing here...
}

Do not call base.OnPaintBac kground in any part of your control.

If you like, e-mail me the OpenGL control source and I'll look it over.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Mark Thompson" <ch****@dsl.pip ex.com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
Bob Powell [MVP] wrote:
You forgot to override OnPaintBackgrou nd so that it doesn't call the base
class didn't you... ;-)


Hi Bob,

Thanks for your help but unfortunately that does not fix it.

I had really high hopes that that would be it when I saw your post but
I have just spent the last hour trying it out. I have tried overriding
it in my OpenGL control. I have tried overriding it in the main form. I
have even tried overriding it in a Custom Panel class that I have which
is substituted for all the panels on the main form in case this was the
problem but to no avail in all cases.

I feel it has to be something simple like this though.

Any other ideas?

Thanks,

Mark.

May 12 '06 #6
Hi Bob,

I have tried to e-mail you at the one on your profile but that just
bounces back. Could you let me know what address to use?

I am at ch****@dsl.pipe x.com by the way.

Thanks,

Mark.

May 15 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3197
by: Rick Muller | last post by:
I have a problem that I would like to get some advice on from other Pythonistas. I currently manage a (soon to be) open source project for displaying molecular graphics for a variety of different programs. To do this I need to draw pictures of the molecules, typically using OpenGL, and do some basic control, using some widget set. The code currently uses GTK, and runs on Macintosh OS X under Fink, and Linux. I would like to support the...
11
6205
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the OnPaint . The recangle draws correct when i press the mouse, but when i release the mouse the background is not restored What should i do in the Onpaint to make sure the background (the form) is restored correctly ? This problem already keeps...
1
1376
by: Qumer Mumtaz | last post by:
H I am using a datagrid and a updown counter Control is added to one the cells of the datagrid. The problem is when I scroll horixentally or vertically the control starts Flickering.What I wanna do is, control does not flicker whenever I scroll horizentally or vertically Any help well comed Thanx
2
3955
by: Ralf Edrich | last post by:
Hi, I want to use (Visual C++) .NET and OpenGL. Are there any known problems or limitations? And can anyone tell me where to get some examples? TIA,
5
4379
by: Jim Hubbard | last post by:
Has anyone seen a fix for the flickering effect you get when resizing a Webbrowser control? It's really irritating and doesn't make for a professional-looking application.
14
2661
by: Jessica Weiner | last post by:
I am writing an application in C# which need to plot graphs and simple shapes (polygons, circles, squares etc). Which library is better for this purpose and why? Thanks.
2
1925
by: Ludwig | last post by:
Hi, thanks to the insight that Kevin Spencer gave me concerning my regular expressions question from a few days ago, I managed to create a first version of my (free) Highlighter RichTextBox control. In short: it highlights portions of text in specified (fore- and background)colors, with a specified parser. I found a number of controls on the net, but all of them had some problems: mostly performance issues with larger texts and...
2
2104
by: sasifiqbal | last post by:
Hi, One of my developers are facing an interesting problem regarding UserControl invalidation. The problem is: We have two forms in our application. Form A does nothing except loading of Form B and Form B contains an array of UserButton kind of contol (we have created our own buttons deriving from UserButton). All the drawings activities in Form B are okay and nothing gets wrong if we
0
1349
by: Mark Thompson | last post by:
Hi, Having given up on CsGL, I have recently integrated the Tao OpenGL components into a VB.NET application that I am developing. I have a problem though in that it works fine on two of the machines we have, but on one of the laptops it crashes. When I say crashes, I mean the CPU use goes to 100% and the application hangs. The only way to recover is to kill it from the Task Manager. The application is a CAD package and it has a "3D...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.