Programs In Computer Graphics Using C

Computer Graphics - C++ Programming Examples and Tutorials. You will find lots of easy to understand tutorials, articles, code, example for Computer Graphics in C++ Programming. Search Projects & Source Codes:: Lakshmi Narayana.A This code implements the classic game: Snake & Ladder. It can be played by two players. Animated 3D Car in Turbo C++ 3.0 - It consist of Lights effect, Sound Effect. Table of Content. Drawing Circle in Graphics Mode; C Program to check if mouse support is available or not. C Program to display mouse pointer in textmode. We shall write our very first graphics program now. Running the first graphics program. Click file ->New ->Project. Make sure you get the Console Graphics option. However, we are not going to click on it. Choose Empty Project option and Give a project name and make sure the selected language is. Analog Clock - This is a graphics program which depict a wall clock. Animated 3D Car in Turbo C++ 3.0 A simple rotation of an ellipse by different angle values.

In Turbo C graphics we use graphics.h functions to draw different shapes(like circle, rectangle etc), display text(any message) in different format(different fonts and colors). By using graphics.h we can make programs, animations and also games. These can be useful for beginners.

Functions Used :

  • delay(n): A function from dos.h header file is responsible for holding of the program for a while depending upon given value n.
  • setcolor(n): A function from graphics.h header file which set the color of pointer(cursor).
  • arc(x,y,a1,a2,r): A function from graphics.h header file which draw an arc with (x,y) as centre (a2-a1) as angle and r as radius.

Implementation:

// A C program to make a rainbow. This program would only
// work in Turbo C compiler in DOS compatible machine
#include<graphics.h>
voidrainbow()
// auto detection
intx, y, i;
// initialize graphics mode(passed three arguments to
// &gdriver is the address of gdriver variable, &gmode is
// 'C:Turboc3BGI' is the directory path where BGI files are stored
x = getmaxx() / 2;//finding centre x-ordinate of screen
y = getmaxy() / 2;//finding centre y-ordinate of screen
for(i=30; i<200; i++)
// delay function under dos.h for holding the
delay(100);
// selecting color for making of rainbow
// making of arc with fixed centre and increasing radius
}
// driver program
{
return0;

Reference:http://www.xcnotes.com/graphics-in-c-language/draw-rainbow-in-c

This article is contributed by Shivam Pradhan (anuj_charm). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.


Recommended Posts:


Programs In Computer Graphics Using C
Top TutorialsNew TutorialsSubmitLoginRegister

Found 10 Tutorials

Most Recent Tutorials


Programs In Computer Graphics Using C
  • Projections

    Learn about Using Projects in OpenGL.
    http://www.cprogramming.com/tutorial/gl7.html
    • 39569 Hits
    • Rating

  • Getting started with OpenGL

    Getting started with OpenGL; The first OpenGL program.
    http://www.cprogramming.com/tutorial/gl6.html
    • 44738 Hits
    • Rating

  • Intro to WGL

    Intro to Windows Graphics Layer.
    http://www.cprogramming.com/tutorial/gl5.html
    • 36357 Hits
    • Rating

  • The WinMain procedure

    The WinMain procedure More Windows Programming background.
    http://www.cprogramming.com/tutorial/gl3.html
    • 34713 Hits
    • Rating

  • OpenGL and Windows

    OpenGL and Windows: Intro to Windows Programming for OpenGL.
    http://www.cprogramming.com/tutorial/gl2.html
    • 36032 Hits
    • Rating

  • Introduction to OpenGL

    OpenGL gives the programmer an interface with the graphics hardware.
    http://www.cprogramming.com/tutorial/gl1.html
    • 43876 Hits
    • Rating

  • Rotation about an Arbitrary Axis

    Describe the calculations performed in order to perform rotations about an arbitrary axis.
    http://www.cprogramming.com/tutorial/3d/rotation.html
    • 34834 Hits
    • Rating

  • Rotation Matrices

    Rotations in Three Dimensions Part Two: Rotation Matrices.
    http://www.cprogramming.com/tutorial/3d/rotationMatrices.html
    • 34577 Hits
    • Rating

  • The Basics of 3D rotations

    The purpose of this tutorial series is to explain the math involved behind rotating points in three dimensions.
    http://www.cprogramming.com/tutorial/3d/theBasics.html
    • 35240 Hits
    • Rating

  • OpenGL video tutorial

    This video tutorial teaches 3D programming in C++ using OpenGL and GLUT.
    http://www.videotutorialsrock.com/
    • 36267 Hits
    • Rating

« PreviousNext »

Computer Graphics Tutorial