I have developed a program that animates a text message is the sense that it moves it around.
For this I have used 2 functions - draw() and erase()
draw() draws the message at a particular coordinate with CYAN color while erase() writes the messages at the same coordinate wit BLACK color(the background color)....Though logically it works, but there is a blinking effect that is annoying and spoils the animation.
Can it be removed??
I am using Turbo c++ v3.0 (cant be helped)
C++ Graphics Programming question
Page 1 of 17 Replies - 652 Views - Last Post: 09 December 2011 - 09:10 AM
Replies To: C++ Graphics Programming question
#2
Re: C++ Graphics Programming question
Posted 07 December 2011 - 09:33 AM
Please post the code you have so far
Also tell us any libraries you are using (if any).
Without this information we cannot help.
Also tell us any libraries you are using (if any).
Without this information we cannot help.
#3
Re: C++ Graphics Programming question
Posted 07 December 2011 - 09:37 AM
I can't really help you with code as I don't know what library you are using to draw. But the this blinking effect is something quite common in computer graphics.
In computer graphics an image is continuously displayed roughly 60 times a seconds. It can happen that an image is displayed while you were still updating it, either with your draw or erase call. the result will be that a half updated image is displayed and this is observed as a blinking effect.
The usual solution is called double buffering. You don't actually write to the image that is being displayed, but to a buffer. Then between 2 frames the entire buffer will be replaced, so no half updates are ever displayed.
So you are looking for an option somewhere to enable double buffering and/or some control thats lets you mark a buffer as complete.
In computer graphics an image is continuously displayed roughly 60 times a seconds. It can happen that an image is displayed while you were still updating it, either with your draw or erase call. the result will be that a half updated image is displayed and this is observed as a blinking effect.
The usual solution is called double buffering. You don't actually write to the image that is being displayed, but to a buffer. Then between 2 frames the entire buffer will be replaced, so no half updates are ever displayed.
So you are looking for an option somewhere to enable double buffering and/or some control thats lets you mark a buffer as complete.
This post has been edited by Karel-Lodewijk: 07 December 2011 - 09:59 AM
#4
Re: C++ Graphics Programming question
Posted 07 December 2011 - 08:15 PM
I am using the inbuilt graphics routines of Turbo C++...Sorry for not providing the code, I forgot! Here's the code :
This is the animation part of the program...
void Display_Text(char String[],int X_Coord,int Y_Coord)
{
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(1,0,8);
outtextxy(X_Coord,Y_Coord,String);
}
void Entry_of_Text(int X_Coord,int Y_Coord,int Color,int Option)
{
setcolor(Color);
setbkcolor(BLACK);
Display_Text("WELCOME ",X_Coord+15,Y_Coord-100);
}
void Erase_Text(int X_Coord , int Y_Coord, int Option)
{
Entry_of_Text(X_Coord,Y_Coord,BLACK,Option);
}
.
.
.
.
if(g_flag!=1)
{
for(int Counter=600;Counter>200;Counter--)
{
Entry_of_Text(305,Counter,LIGHTCYAN,ENTRY);
delay(5);
Erase_Text(305,Counter,ENTRY);
}
Entry_of_Text(305,200,LIGHTCYAN,ENTRY);
delay(1000);
setcolor(WHITE);
}
This is the animation part of the program...
#5
Re: C++ Graphics Programming question
Posted 08 December 2011 - 02:02 PM
Well I can give you one piece of advice that you should definitely follow. Get a new IDE, Turbo C++ is ancient and unsupported.
http://www.microsoft...ual-cpp-express
http://www.microsoft...ual-cpp-express
#6
Re: C++ Graphics Programming question
Posted 09 December 2011 - 08:13 AM
Usually flickering cant be avoided in console programs.
Console uses text mode to display graphics.
Still if you want to use console and have better graphics i would recommend graphicsmagician.com it supports DirectX with console and it is easy to use.
for that you have to stop using Turbo++ It is really ancient now.
Try Visual C++ express from Microsoft. It is free and easy to use!
Console uses text mode to display graphics.
Still if you want to use console and have better graphics i would recommend graphicsmagician.com it supports DirectX with console and it is easy to use.
for that you have to stop using Turbo++ It is really ancient now.
Try Visual C++ express from Microsoft. It is free and easy to use!
#7
Re: C++ Graphics Programming question
Posted 09 December 2011 - 08:32 AM
I'd really prefer newer IDE's but I cant do so because of the people deiding on curriculum, they dont seem to wnat any change. It is a project so I have to do it in TC.
Btw, Ive read that TC displays graphics in graphics mode only.
Though I've not shown here, I have initialized the graphics mode using initgraph() function.
Btw, Ive read that TC displays graphics in graphics mode only.
Though I've not shown here, I have initialized the graphics mode using initgraph() function.
#8
Re: C++ Graphics Programming question
Posted 09 December 2011 - 09:10 AM
There are methods of reducing this blinking, one is to "double buffer" the screen. Look at get/putimage. You may try Googling "BGI Documentation" for more information. My suggestion would be to stop using this graphics system and stick with plain console text mode, unless you are willing to "go it alone". This package is very old and you will probably have problems finding much documentation or very many people who even remember how this archaic library works.
Jim
Jim
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|