7 Replies - 652 Views - Last Post: 09 December 2011 - 09:10 AM Rate Topic: -----

#1 bloodzdevil  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 55
  • Joined: 12-June 10

C++ Graphics Programming question

Posted 07 December 2011 - 09:14 AM

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)

Is This A Good Question/Topic? 0
  • +

Replies To: C++ Graphics Programming question

#2 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 928
  • View blog
  • Posts: 3,997
  • Joined: 14-February 08

Re: C++ Graphics Programming question

Posted 07 December 2011 - 09:33 AM

Please post the code you have so far
:code:

Also tell us any libraries you are using (if any).

Without this information we cannot help.
Was This Post Helpful? 0
  • +
  • -

#3 Karel-Lodewijk  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 445
  • View blog
  • Posts: 849
  • Joined: 17-March 11

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.

This post has been edited by Karel-Lodewijk: 07 December 2011 - 09:59 AM

Was This Post Helpful? 1
  • +
  • -

#4 bloodzdevil  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 55
  • Joined: 12-June 10

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 :

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...
Was This Post Helpful? 0
  • +
  • -

#5 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 928
  • View blog
  • Posts: 3,997
  • Joined: 14-February 08

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
Was This Post Helpful? 0
  • +
  • -

#6 yaKashif  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 03-October 11

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!
Was This Post Helpful? 0
  • +
  • -

#7 bloodzdevil  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 55
  • Joined: 12-June 10

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.
Was This Post Helpful? 0
  • +
  • -

#8 jimblumberg  Icon User is offline

  • member icon

Reputation: 3044
  • View blog
  • Posts: 9,279
  • Joined: 25-December 09

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1