SlideShare a Scribd company logo
7
SDL-Libgraph
●

●

●

It works efficiently with open source C compiler
gcc.
It is required to add the sdl-libgraph library to
current existing gcc.
Let's see how to do it in GNU/Linux Ubuntu
distribution. [Next slide]
Most read
9
Actual Demo
Most read
10
Step-2
●

●

●

●

●

●

●

●

●

You 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

●

libdirectfb-extra

libsdl-image1.2-dev

●

libxext-dev

guile-1.8

●

x11proto-xext-dev

guile-1.8-dev

●

libfreetype6

libart-2.0-dev

●

libaa1

libaudiofile-dev

●

libaa1-dev

libesd0-dev

●

libslang2-dev

●

libasound2

●

libasound2-dev

libdirectfb-dev
Most read
Graphics Programming in C under
GNU / Linux (Ubuntu Distribution)
Tushar B Kute
Nashik Linux User Group
http://snashlug.org
Graphics Programming in C
●

OpenGL

●

Gtk+

●

SDL Libgraph
OpenGL
●

●

OpenGL (Open Graphics Library) is a cross-language,
multi-platform application programming interface (API) for
rendering 2D and 3D computer graphics. The API is typically
used to interact with a Graphics processing unit (GPU), to
achieve hardware-accelerated rendering.
OpenGL was developed by Silicon Graphics Inc. (SGI) from 1991
and released in January 1992 and is widely used in CAD, virtual
reality, scientific visualization, information visualization, flight
simulation, and video games. OpenGL is managed by the
non-profit technology consortium Khronos Group.
gtk+
●

●

GTK+ (GIMP Toolkit) is a cross-platform widget toolkit
for creating graphical user interfaces. It is licensed
under the terms of the GNU LGPL, allowing both free
and proprietary software to use it. It is one of the most
popular toolkits for the X Window System, along with
Qt.
The name GTK+ originates from GTK; the plus was
added to distinguish an enhanced version. It was
originally created for the GNU Image Manipulation
Program (GIMP), a free software raster graphics editor
in 1997.
SDL
●

●

Simple DirectMedia Layer (SDL) is a cross-platform, free and open
source multimedia library written in C that presents a simple interface
to various platforms' graphics, sound, and input devices. It is widely
used due to its simplicity. Over 700 games, 180 applications, and 120
demos have been posted on its website.
SDL has the word "layer" in its title because it is actually a wrapper
around operating-system-specific functions. The main purpose of SDL
is to provide a common framework for accessing these functions. For
further functionality beyond this goal, many libraries have been
created to work on top of SDL.
libgraph
●

●

●

●

This project is not part of the GNU Project.
libgraph is an implementation of the TurboC graphics API (graphics.h)
on GNU/Linux using SDL. The library requires SDL for primitive
graphics and SDL_image (to blit fonts). Functions for text display are
based heavily on code "borrowed" from Karl Bartel's SFont library.
The library is not very powerful or flexible. It is probably not suitable
for use in production-quality applications. I see it more as a simple,
easy-to-use 2D graphics interface - could be used for simple
prototyping, visualization or studying graphics algorithms.
It is simplified library to run graphics programs in C.
SDL-Libgraph
●

●

●

It works efficiently with open source C compiler
gcc.
It is required to add the sdl-libgraph library to
current existing gcc.
Let's see how to do it in GNU/Linux Ubuntu
distribution. [Next slide]
Step-1
●

●

Make sure you have the basic compiler installed.
You need the build-essential package. For this, run
the command on terminal:
sudo apt-get install build-essential

●

You must have internet connection for this
command to work.
Actual Demo
Step-2
●

●

●

●

●

●

●

●

●

You 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

●

libdirectfb-extra

libsdl-image1.2-dev

●

libxext-dev

guile-1.8

●

x11proto-xext-dev

guile-1.8-dev

●

libfreetype6

libart-2.0-dev

●

libaa1

libaudiofile-dev

●

libaa1-dev

libesd0-dev

●

libslang2-dev

●

libasound2

●

libasound2-dev

libdirectfb-dev
Single stroke command
●

sudo apt-get install libsdl-image1.2
libsdl-image1.2-dev guile-1.8 guile-1.8-dev
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
Actual Demo
Step-3
●

●

●

Now, download libgraph from:
(http://download.savannah.gnu.org/releases/libgraph/libgraph-1.
0.2.tar.gz)
Then 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
Actual Demo
Step-4
●

Now you are ready to compile your C program!

●

Write your C program using any editor and save.

●

Open the terminal for the specified folder and then
run with:
gcc MyProg.c -lgraph
./a.out

●

Once all this installation process is done, you don't
need to follow this process again and again. Just
compile and execute the program.
Example: MyProg.c
#include<graphics.h>
int main()
{
int gd = DETECT, gm = 0;
initgraph(&gd, &gm,""); // initialize graphics
circle(300, 300, 150);

// graphics function for circle

getch();

// this is must to hold output!

closegraph();
return 0;

}
Execution of program
Output Window

You may use print screen (PrtSc) button to take output.
By default, this image get stored in /home/Pictures.
Final work
●

●

You may use “Shotwell Photo Viewer” to crop the
image output!
Generally making background White and
foreground Black create good effect in output for
taking printout.
Sample Program
int gd = DETECT, gm = 0;
initgraph(&gd, &gm,"");
setbkcolor(WHITE);
setcolor(BLACK);
circle(300, 300, 150);
getch();
closegraph();
Final Output
Thank you
tushar.kute@gmail.com
http://tusharkute.com

This presentation is created using LibreOffice Impress 4.0.2.2
Use open source, be safe and secure

More Related Content

What's hot (20)

tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
WE-IT TUTORIALS
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
GR Techno Solutions
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Matt Harrison
 
Computer languages 11
Computer languages 11Computer languages 11
Computer languages 11
Muhammad Ramzan
 
Mysql:Operators
Mysql:OperatorsMysql:Operators
Mysql:Operators
DataminingTools Inc
 
Flutter
FlutterFlutter
Flutter
Toma Velev
 
Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)
Randal Schwartz
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Benny Skogberg
 
Introduction to Qt
Introduction to QtIntroduction to Qt
Introduction to Qt
Puja Pramudya
 
Report on hyperthreading
Report on hyperthreadingReport on hyperthreading
Report on hyperthreading
deepakmarndi
 
Flutter UI Framework
Flutter UI FrameworkFlutter UI Framework
Flutter UI Framework
Yuliia Makarenko
 
Presentation on Programming Languages.
Presentation on Programming Languages.Presentation on Programming Languages.
Presentation on Programming Languages.
Mohammad Shakirul islam
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
Remo Jansen
 
Android seminar ppt
Android seminar pptAndroid seminar ppt
Android seminar ppt
chakrapani tripathi
 
Python Presentation
Python PresentationPython Presentation
Python Presentation
Narendra Sisodiya
 
Cuda
CudaCuda
Cuda
Mannu Malhotra
 
GPU - Basic Working
GPU - Basic WorkingGPU - Basic Working
GPU - Basic Working
Nived R Nambiar
 
Introduction to Skia by Ryan Chou @20141008
Introduction to Skia by Ryan Chou @20141008Introduction to Skia by Ryan Chou @20141008
Introduction to Skia by Ryan Chou @20141008
Ryan Chou
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutter
rihannakedy
 
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
WE-IT TUTORIALS
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
GR Techno Solutions
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Matt Harrison
 
Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)
Randal Schwartz
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Benny Skogberg
 
Report on hyperthreading
Report on hyperthreadingReport on hyperthreading
Report on hyperthreading
deepakmarndi
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
Remo Jansen
 
Introduction to Skia by Ryan Chou @20141008
Introduction to Skia by Ryan Chou @20141008Introduction to Skia by Ryan Chou @20141008
Introduction to Skia by Ryan Chou @20141008
Ryan Chou
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutter
rihannakedy
 

Similar to Graphics Programming in C under GNU Linux (Ubuntu distribution) (20)

Introduction to graphics programming in c
Introduction to graphics programming in cIntroduction to graphics programming in c
Introduction to graphics programming in c
baabtra.com - No. 1 supplier of quality freshers
 
Embedded Linux Multimedia
Embedded Linux MultimediaEmbedded Linux Multimedia
Embedded Linux Multimedia
Caglar Dursun
 
One Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launchesOne Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launches
Leszek Godlewski
 
Graphical libraries
Graphical librariesGraphical libraries
Graphical libraries
guestbd40369
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
Leszek Godlewski
 
SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013
Eric Basile
 
01 first
01 first01 first
01 first
scythus
 
The Ring programming language version 1.5.2 book - Part 47 of 181
The Ring programming language version 1.5.2 book - Part 47 of 181The Ring programming language version 1.5.2 book - Part 47 of 181
The Ring programming language version 1.5.2 book - Part 47 of 181
Mahmoud Samir Fayed
 
There is more to C
There is more to CThere is more to C
There is more to C
Juraj Michálek
 
Advanced Linux Game Programming
Advanced Linux Game ProgrammingAdvanced Linux Game Programming
Advanced Linux Game Programming
Leszek Godlewski
 
GLX, DRI, and i965
GLX, DRI, and i965GLX, DRI, and i965
GLX, DRI, and i965
Chia-I Wu
 
The Ring programming language version 1.6 book - Part 50 of 189
The Ring programming language version 1.6 book - Part 50 of 189The Ring programming language version 1.6 book - Part 50 of 189
The Ring programming language version 1.6 book - Part 50 of 189
Mahmoud Samir Fayed
 
Autotools pratical training
Autotools pratical trainingAutotools pratical training
Autotools pratical training
Thierry Gayet
 
Graphics Libraries
Graphics LibrariesGraphics Libraries
Graphics Libraries
Prachi Mishra
 
Qt5 on ti processors
Qt5 on ti processorsQt5 on ti processors
Qt5 on ti processors
Prabindh Sundareson
 
Computer graphics workbook
Computer graphics workbookComputer graphics workbook
Computer graphics workbook
Muhammadalizardari
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learned
basisspace
 
G T K+ 101
G T K+ 101G T K+ 101
G T K+ 101
Ahmed Saeed
 
Embedded Linux - Building toolchain
Embedded Linux - Building toolchainEmbedded Linux - Building toolchain
Embedded Linux - Building toolchain
Emertxe Information Technologies Pvt Ltd
 
1 introduction computer graphics
1 introduction computer graphics1 introduction computer graphics
1 introduction computer graphics
cairo university
 
Embedded Linux Multimedia
Embedded Linux MultimediaEmbedded Linux Multimedia
Embedded Linux Multimedia
Caglar Dursun
 
One Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launchesOne Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launches
Leszek Godlewski
 
Graphical libraries
Graphical librariesGraphical libraries
Graphical libraries
guestbd40369
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
Leszek Godlewski
 
SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013
Eric Basile
 
01 first
01 first01 first
01 first
scythus
 
The Ring programming language version 1.5.2 book - Part 47 of 181
The Ring programming language version 1.5.2 book - Part 47 of 181The Ring programming language version 1.5.2 book - Part 47 of 181
The Ring programming language version 1.5.2 book - Part 47 of 181
Mahmoud Samir Fayed
 
Advanced Linux Game Programming
Advanced Linux Game ProgrammingAdvanced Linux Game Programming
Advanced Linux Game Programming
Leszek Godlewski
 
GLX, DRI, and i965
GLX, DRI, and i965GLX, DRI, and i965
GLX, DRI, and i965
Chia-I Wu
 
The Ring programming language version 1.6 book - Part 50 of 189
The Ring programming language version 1.6 book - Part 50 of 189The Ring programming language version 1.6 book - Part 50 of 189
The Ring programming language version 1.6 book - Part 50 of 189
Mahmoud Samir Fayed
 
Autotools pratical training
Autotools pratical trainingAutotools pratical training
Autotools pratical training
Thierry Gayet
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learned
basisspace
 
1 introduction computer graphics
1 introduction computer graphics1 introduction computer graphics
1 introduction computer graphics
cairo university
 
Ad

More from Tushar B Kute (20)

ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdfॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
Tushar B Kute
 
Apache Pig: A big data processor
Apache Pig: A big data processorApache Pig: A big data processor
Apache Pig: A big data processor
Tushar B Kute
 
01 Introduction to Android
01 Introduction to Android01 Introduction to Android
01 Introduction to Android
Tushar B Kute
 
Ubuntu OS and it's Flavours
Ubuntu OS and it's FlavoursUbuntu OS and it's Flavours
Ubuntu OS and it's Flavours
Tushar B Kute
 
Install Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. KuteInstall Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. Kute
Tushar B Kute
 
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. KuteInstall Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Tushar B Kute
 
Share File easily between computers using sftp
Share File easily between computers using sftpShare File easily between computers using sftp
Share File easily between computers using sftp
Tushar B Kute
 
Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in Linux
Tushar B Kute
 
Implementation of FIFO in Linux
Implementation of FIFO in LinuxImplementation of FIFO in Linux
Implementation of FIFO in Linux
Tushar B Kute
 
Implementation of Pipe in Linux
Implementation of Pipe in LinuxImplementation of Pipe in Linux
Implementation of Pipe in Linux
Tushar B Kute
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix Threads
Tushar B Kute
 
Part 04 Creating a System Call in Linux
Part 04 Creating a System Call in LinuxPart 04 Creating a System Call in Linux
Part 04 Creating a System Call in Linux
Tushar B Kute
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
Tushar B Kute
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
Open source applications softwares
Open source applications softwaresOpen source applications softwares
Open source applications softwares
Tushar B Kute
 
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Tushar B Kute
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Tushar B Kute
 
Technical blog by Engineering Students of Sandip Foundation, itsitrc
Technical blog by Engineering Students of Sandip Foundation, itsitrcTechnical blog by Engineering Students of Sandip Foundation, itsitrc
Technical blog by Engineering Students of Sandip Foundation, itsitrc
Tushar B Kute
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdfॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
ॲलन ट्युरिंग: कृत्रिम बुद्धिमत्तेचा अग्रदूत - लेखक: तुषार भ. कुटे.pdf
Tushar B Kute
 
Apache Pig: A big data processor
Apache Pig: A big data processorApache Pig: A big data processor
Apache Pig: A big data processor
Tushar B Kute
 
01 Introduction to Android
01 Introduction to Android01 Introduction to Android
01 Introduction to Android
Tushar B Kute
 
Ubuntu OS and it's Flavours
Ubuntu OS and it's FlavoursUbuntu OS and it's Flavours
Ubuntu OS and it's Flavours
Tushar B Kute
 
Install Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. KuteInstall Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. Kute
Tushar B Kute
 
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. KuteInstall Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Tushar B Kute
 
Share File easily between computers using sftp
Share File easily between computers using sftpShare File easily between computers using sftp
Share File easily between computers using sftp
Tushar B Kute
 
Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in Linux
Tushar B Kute
 
Implementation of FIFO in Linux
Implementation of FIFO in LinuxImplementation of FIFO in Linux
Implementation of FIFO in Linux
Tushar B Kute
 
Implementation of Pipe in Linux
Implementation of Pipe in LinuxImplementation of Pipe in Linux
Implementation of Pipe in Linux
Tushar B Kute
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix Threads
Tushar B Kute
 
Part 04 Creating a System Call in Linux
Part 04 Creating a System Call in LinuxPart 04 Creating a System Call in Linux
Part 04 Creating a System Call in Linux
Tushar B Kute
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
Tushar B Kute
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
Open source applications softwares
Open source applications softwaresOpen source applications softwares
Open source applications softwares
Tushar B Kute
 
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Introduction to Ubuntu Edge Operating System (Ubuntu Touch)
Tushar B Kute
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Tushar B Kute
 
Technical blog by Engineering Students of Sandip Foundation, itsitrc
Technical blog by Engineering Students of Sandip Foundation, itsitrcTechnical blog by Engineering Students of Sandip Foundation, itsitrc
Technical blog by Engineering Students of Sandip Foundation, itsitrc
Tushar B Kute
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
Ad

Recently uploaded (20)

Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 

Graphics Programming in C under GNU Linux (Ubuntu distribution)

  • 1. Graphics Programming in C under GNU / Linux (Ubuntu Distribution) Tushar B Kute Nashik Linux User Group http://snashlug.org
  • 2. Graphics Programming in C ● OpenGL ● Gtk+ ● SDL Libgraph
  • 3. OpenGL ● ● OpenGL (Open Graphics Library) is a cross-language, multi-platform application programming interface (API) for rendering 2D and 3D computer graphics. The API is typically used to interact with a Graphics processing unit (GPU), to achieve hardware-accelerated rendering. OpenGL was developed by Silicon Graphics Inc. (SGI) from 1991 and released in January 1992 and is widely used in CAD, virtual reality, scientific visualization, information visualization, flight simulation, and video games. OpenGL is managed by the non-profit technology consortium Khronos Group.
  • 4. gtk+ ● ● GTK+ (GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt. The name GTK+ originates from GTK; the plus was added to distinguish an enhanced version. It was originally created for the GNU Image Manipulation Program (GIMP), a free software raster graphics editor in 1997.
  • 5. SDL ● ● Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices. It is widely used due to its simplicity. Over 700 games, 180 applications, and 120 demos have been posted on its website. SDL has the word "layer" in its title because it is actually a wrapper around operating-system-specific functions. The main purpose of SDL is to provide a common framework for accessing these functions. For further functionality beyond this goal, many libraries have been created to work on top of SDL.
  • 6. libgraph ● ● ● ● This project is not part of the GNU Project. libgraph is an implementation of the TurboC graphics API (graphics.h) on GNU/Linux using SDL. The library requires SDL for primitive graphics and SDL_image (to blit fonts). Functions for text display are based heavily on code "borrowed" from Karl Bartel's SFont library. The library is not very powerful or flexible. It is probably not suitable for use in production-quality applications. I see it more as a simple, easy-to-use 2D graphics interface - could be used for simple prototyping, visualization or studying graphics algorithms. It is simplified library to run graphics programs in C.
  • 7. SDL-Libgraph ● ● ● It works efficiently with open source C compiler gcc. It is required to add the sdl-libgraph library to current existing gcc. Let's see how to do it in GNU/Linux Ubuntu distribution. [Next slide]
  • 8. Step-1 ● ● Make sure you have the basic compiler installed. You need the build-essential package. For this, run the command on terminal: sudo apt-get install build-essential ● You must have internet connection for this command to work.
  • 10. Step-2 ● ● ● ● ● ● ● ● ● You 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 ● libdirectfb-extra libsdl-image1.2-dev ● libxext-dev guile-1.8 ● x11proto-xext-dev guile-1.8-dev ● libfreetype6 libart-2.0-dev ● libaa1 libaudiofile-dev ● libaa1-dev libesd0-dev ● libslang2-dev ● libasound2 ● libasound2-dev libdirectfb-dev
  • 11. Single stroke command ● sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev 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
  • 13. Step-3 ● ● ● Now, download libgraph from: (http://download.savannah.gnu.org/releases/libgraph/libgraph-1. 0.2.tar.gz) Then 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
  • 15. Step-4 ● Now you are ready to compile your C program! ● Write your C program using any editor and save. ● Open the terminal for the specified folder and then run with: gcc MyProg.c -lgraph ./a.out ● Once all this installation process is done, you don't need to follow this process again and again. Just compile and execute the program.
  • 16. Example: MyProg.c #include<graphics.h> int main() { int gd = DETECT, gm = 0; initgraph(&gd, &gm,""); // initialize graphics circle(300, 300, 150); // graphics function for circle getch(); // this is must to hold output! closegraph(); return 0; }
  • 18. Output Window You may use print screen (PrtSc) button to take output. By default, this image get stored in /home/Pictures.
  • 19. Final work ● ● You may use “Shotwell Photo Viewer” to crop the image output! Generally making background White and foreground Black create good effect in output for taking printout.
  • 20. Sample Program int gd = DETECT, gm = 0; initgraph(&gd, &gm,""); setbkcolor(WHITE); setcolor(BLACK); circle(300, 300, 150); getch(); closegraph();
  • 22. Thank you [email protected] http://tusharkute.com This presentation is created using LibreOffice Impress 4.0.2.2 Use open source, be safe and secure