Computer Graphics Programs for SE Computer Engineering Students
Installing graphics.h in Linux Ubuntu
STEP- 1
Make sure you have the basic compilers installed.
You need the build-essential package. For this, run the command:
> sudo apt-get install build-essential
> sudo apt-get install g++
STEP- 2
First we need to install a hand full of packages. You can simply run the following command and get it all done.
> sudo apt-get install libsdl-image1.2
> libsdl-image1.2-dev
> guile-1.8
> guile-1.8-dev
> libsdl1.2debian-all
> libart-2.0-dev
> libaudiofile-dev
> libesd0-dev
> libdirectfb-dev
> libdirectfb-extra
> libfreetype6-dev
> libxext-dev
> x11proto-xext-dev
> libfreetype6
> libaa1
> libaa1-dev
> libslang2-dev
> libasound2
> libasound2-dev
STEP- 3
Now, download libgraph.
Copy the file libgraph-1.0.2.tar.gz to our home folder. Right click on the file and select Extract here.
Open a terminal and run the following commands, one by one.
> cd libgraph-1.0.2
> ./configure
> sudo make
> sudo make install
> sudo cp /usr/local/lib/libgraph.* /usr/lib
Make sure you have the basic compilers installed.
You need the build-essential package. For this, run the command:
> sudo apt-get install build-essential
> sudo apt-get install g++
STEP- 2
First we need to install a hand full of packages. You can simply run the following command and get it all done.
> sudo apt-get install libsdl-image1.2
> libsdl-image1.2-dev
> guile-1.8
> guile-1.8-dev
> libsdl1.2debian-all
> libart-2.0-dev
> libaudiofile-dev
> libesd0-dev
> libdirectfb-dev
> libdirectfb-extra
> libfreetype6-dev
> libxext-dev
> x11proto-xext-dev
> libfreetype6
> libaa1
> libaa1-dev
> libslang2-dev
> libasound2
> libasound2-dev
STEP- 3
Now, download libgraph.
Copy the file libgraph-1.0.2.tar.gz to our home folder. Right click on the file and select Extract here.
Open a terminal and run the following commands, one by one.
> cd libgraph-1.0.2
> ./configure
> sudo make
> sudo make install
> sudo cp /usr/local/lib/libgraph.* /usr/lib
STEP- 4
Now you’re ready to compile your C++ program!
$ g++ program-name.cpp -o program-name -lgraph
$ ./program-name
Now you’re ready to compile your C++ program!
$ g++ program-name.cpp -o program-name -lgraph
$ ./program-name
Installing eclipse in Linux Ubuntu
First of all, you need to check whether you have java installed on your system. You can check by using the command:
java -version
If java is not installed, then you should install it by doing
sudo apt-get install default-jre
Afterwards, download Eclipse from the download section of the official website (http://www.eclipse.org/downloads/). Remember to choose the correct package for your architecture (32bit or 64 bit). The package will have the name:
eclipse-standard-kepler-SR1-linux-gtk-x86_32.tar.gz
or
eclipse-standard-kepler-SR1-linux-gtk-x86_64.tar.gz
After you have downloaded the correct package, extract the eclipse.XX.YY.tar.gz using
tar -zxvf eclipse.XX.YY.tar.gz
switch to root user:sudo -i
Copy the extracted folder to /optcp -r eclipse.XX.YY /opt
Create a desktop file and install it:gedit eclipse.desktop
Copy the following to the eclipse.desktop file.[Desktop Entry]
Name=Eclipse
Type=Application
Exec=eclipse
Terminal=false
Icon=eclipse
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
Run the following command to automatically install it in the unity:desktop-file-install eclipse.desktop
Create a symlink in /usr/local/bin usingcd /usr/local/bin
ln -s /opt/eclipse/eclipse
For an eclipse icon to be displayed in dash, eclipse icon can be added ascp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm
How to Install OpenGL/Glut libraries in Ubuntu 12.04
The first step is to install the development libraries of OpenGL/Glut in Ubuntu:-# sudo apt-get install freeglut3 freeglut3-dev
For newer versions of Ubuntu (>= 11.10) you have to install another package because the linker does’t link anymore.
# sudo apt-get install binutils-gold
Now create a test file (test.c) save it :
EXAMPLE:
#include <GL/glut.h>//Drawing funciton
void draw(void)
{
//Background color
glClearColor(0,1,0,1);
glClear(GL_COLOR_BUFFER_BIT );
//Draw order
glFlush();
} //Main program
int main(int argc, char **argv)
{
glutInit(&argc, argv);
//Simple buffer
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition(50,25);
glutInitWindowSize(500,250);
glutCreateWindow(“Green window”);
//Call to the drawing function
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}
void draw(void)
{
//Background color
glClearColor(0,1,0,1);
glClear(GL_COLOR_BUFFER_BIT );
//Draw order
glFlush();
} //Main program
int main(int argc, char **argv)
{
glutInit(&argc, argv);
//Simple buffer
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition(50,25);
glutInitWindowSize(500,250);
glutCreateWindow(“Green window”);
//Call to the drawing function
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}
Compile the file linking the OpenGL/Glut libraries:-
# cd /Desktop
# gcc -lGL -lglut test.c -o test
# ./test
Finish
If you have already installed "Eclipse for Java Developers" or other Eclipse packages, you could install the CDT plug-in as follows: Launch Eclipse ⇒ Help ⇒ Install New Software ⇒ In "Work with" field, pull down the drop-down menu and select "Kepler - http://download.eclipse.org/releases/kepler" (or juno for Eclipse 4.2; or helios for Eclipse 3.7).
In "Name" box, expand "Programming Language" node ⇒ Check "C/C++ Development Tools" ⇒ "Next" ⇒ ... ⇒ "Finish".
How to install and use Eclipse CDT for C/C++ programming
Follow the link....
http://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html
OR
Step 1: Install Eclipse C/C++ Development Tool (CDT)
1. Two ways to install CDT, depending on whether you have previously installed an Eclipse:If you have already installed "Eclipse for Java Developers" or other Eclipse packages, you could install the CDT plug-in as follows: Launch Eclipse ⇒ Help ⇒ Install New Software ⇒ In "Work with" field, pull down the drop-down menu and select "Kepler - http://download.eclipse.org/releases/kepler" (or juno for Eclipse 4.2; or helios for Eclipse 3.7).
In "Name" box, expand "Programming Language" node ⇒ Check "C/C++ Development Tools" ⇒ "Next" ⇒ ... ⇒ "Finish".
2. If you have not install any Eclipse package, you could download "Eclipse IDE for C/C++ Developers" from http://www.eclipse.org/downloads, and unzip the downloaded file into a directory of your choice.
You do NOT need to do any configuration, as long as the Cygwin or MinGW binaries are included in the
Step 2: Configuration
You do NOT need to do any configuration, as long as the Cygwin or MinGW binaries are included in the PATH
environment variable. CDT searches the PATH
to discover the C/C++ compilers.
Writing your First C/C++ Program in Eclipse
Step 0: Launch Eclipse
Start Eclipse by running "eclipse.exe
" in the Eclipse installed directory.Choose an appropriate directory for your workspace (i.e., where you would like to save your works).
If the "welcome" screen shows up, close it by clicking the "close" button.
Step 1: Create a new C++ Project
For each C++ application, you need to create a project to keep all the source codes, object files, executable files, and relevant resources.To create a new C++ project:
Choose "File" menu ⇒ "New" ⇒ Project... ⇒ C/C++ ⇒ C++ project.
The "C++ Project" dialog pops up.
In "Project name" field, enter "
In "Project Types" box, select "Executable" ⇒ "Empty Project".
In "Toolchains" box, choose your compiler, e.g., "Cygwin GCC" or "MinGW GCC" ⇒ Next.
FirstProject
".In "Project Types" box, select "Executable" ⇒ "Empty Project".
In "Toolchains" box, choose your compiler, e.g., "Cygwin GCC" or "MinGW GCC" ⇒ Next.
The "Select Configurations" dialog appears. Select both "Debug" and "Release" ⇒ Finish.
The "New Source File" dialog pops up.
Step 2: Write a Hello-world C++ Program
In the "Project Explorer" (leftmost panel) ⇒ Right-click on "FirstProject
" (or use the "File" menu) ⇒ New ⇒ Source File.The "New Source File" dialog pops up.
In "Source file" field, enter "
Click "Finish".
Hello.cpp
".Click "Finish".
The source file "
NOTE: You need to create a new C++ project for EACH of your programming problems. This is messy for writing toy programs!
Hello.cpp
" opens on the editor panel (double-click on "test.cpp
" to open if necessary). Enter the following codes:
#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!" << endl;
return 0;
}
Step 3: Compile/Build
Right-click on the "FirstProject
" (or use the "Project" menu) ⇒ choose "Build Project" to compile and link the program.Step 4: Run
To run the program, right-click on the "FirstProject
" (or anywhere on the source "test.cpp
",
or select the "Run" menu) ⇒ Run As ⇒ Local C/C++ Application ⇒ (If ask,
choose Cygwin's gdb debugger) ⇒ The output "Hello, world!" appears on
the "Console" panel.NOTE: You need to create a new C++ project for EACH of your programming problems. This is messy for writing toy programs!
Great Article
ReplyDeleteIEEE Projects for Engineering Students
Final Year Projects for CSE