Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeIDERAD Studio

Graphics – A Complete Guide To Programming In C++

slide7 2

All visual displays are formed from pixels – small RGB LED groups on your computer screen. These pixels are small colored lights which combine together into what we perceive as graphics and text. C++ is one of the best programming languages to analyze and draw these graphics as fast as possible. C++ Builder has a number of different ways of performing pixel operations on bitmaps and other graphical types. In this post we discuss how to use graphics, colors, and 3D Objects in a modern C++ app.

This article is part of a series which teaches you the basics of how to write C++ software.

A Complete Guide To Programming In C++ with 2D Graphics

All images computerized pictures, photos, drawings, icons, emojis, all UI elements consist of pixels. You just need to change the colors of a pixel to draw a beautiful drawing or to edit a photo. Let’s see some 2D graphical operations on bitmaps and colors.

Introduction To Graphics

  1. Colors In Modern C++ For Windows Development
  2. Learn About Bitmap Operations In C++ Builder (FireMonkey)
  3. Quickly Learn How To Use Canvas Drawing In C++ On Windows
  4. Quickly Learn To Draw Powerful Mathematical Functions Dynamically in Modern C++ on Windows
  5. Quickly Learn To Develop A Simple Windows Paint Application in Modern C++
  6. Learn to Generate Beautiful Color Gradients in C++ Builder
  7. Learn To Create Alpha Color Bitmap From A Bitmap By A Given Color In Modern C++
  8. Learn To Modernize Appearance Of Windows VCL Applications By Using Powerful Styles
  9. Learn To Modernize Appearance Of Multi-Platform C++ Builder FMX Applications By Using Styles
  10. How To Create And Add Icon Images To Windows Apps
  11. How To Create App Splash Screens For Android And iOS In C++
  12. This Is How To Visualize Kinematics In Windows C++ Apps
  13. How To Use Scanline In Bitmaps In A VCL C++ App?
Graphics A Complete Guide To Programming In C++ a person with a tablet device looking at some charts

A Complete Guide To Programming In C++ with 3D Graphics

The 3-dimensional display of a scene on a digital platform is a 2-dimensional projection of drawings of 3D objects in a given scene. We can mathematically calculate a solid object, its position, its projection on our 2D screen, we can add colors on it, light effects, textures, camera, movements and some other techniques to show our 3D object as effectively and realistically as possible. This may take a lot of time to develop all 2D and 3D mathematical operations. In C++ Builder we can use the OpenGL and DirectX graphic libraries which come with methods to help us visualize and manipulate graphics. If we are developing a simple 3D application, we can also use 3D components, both those from C++ Builder and also the graphical libraries it supports. In this post we will list these 3D components.

Introduction To 3D Graphics

3D Objects are like wrapped papers in 3D form. They consist of ‘points’ which describe the anchors of a particular shape or object. For example, 4 points might be used to describe the corners of the shape of a polygon. In modern application development most of these objects are generated by a 3D Designer Software with their own 3d Object standards and these are displayed or animated in mechanics by a 3D Engine. In C++ Builder you can directly create your own 3D objects, you can animate them at runtime. The Viewport3D (TViewportd3D) component in C++ Builder FireMonkey projects is used to display many basic 3D Objects like Plane, Cube, Sphere, Cone, Plane, Ellipse3D etc. You can also easily load your 3D objects into Viewport3D by using Model3D (TModel3D). In this section we give examples and more details about how to use 3D graphics in C++.

  1. Quickly Learn About Working With 3D Windows Components In C++ Development
    Viewport3D, Camera Light, Dummy Object, Proxy Object, ColorMaterialSource, TextureMaterialSource, LightMaterialSource
  2. Learn About Working With 3D In Modern Windows C++ Development
    Creating a 3D Object on Runtime, Plane, Disk, Cube, Rectangle3D, Sphere, Cylinder, Ellipse3D, Cone, Text3D
  3. Learn To Quickly Create Specific 3D Objects In Modern C++ Applications For Windows
    (ViewPort3D, Model3D, Mesh; MaterialSource
Graphics A Complete Guide To Programming In C++ an image of a person intently looking at a game on multiple PC screens

Advanced 3D Graphics and Gaming In Your C++ App

Our screens are 2D dimensional planes (flat surfaces, with no actual depth, also known as the Z axis) and consist of pixels in the X and Y directions. How can we display a 3D object in this 2D plane? 3D objects in our 2D screens are a projection of 3D coordinates using mathematical calculations. In 3D operations, i.e. in 3D graphics, 3D robotics, 3D mechanics; we use matrix forms which are multi-dimensional arrays in C++. Generally, they are 3-dimensional arrays formed with floats or doubles. In some cases, to speed up graphical operations integers or integer arrays for float values are also used.

  1. Learn to Use 3D Rotation Matrix in Low Level C++ Graphic Applications
  2. Learn to Develop a Perseverance Mars Simulation 3D in C++ Builder
  3. How To: Develop A Fun 3D Game Like Minecraft In C++
  4. Let’s Fly Ingenuity Helicopter 3D Model with C++ Builder on Windows
  5. This Is The Smart Low Code Way To Do 3D Visualization In C++
  6. Learn to Visualize Topographic 3D Data in C++ Builder
  7. Learn to Develop a Text Based Simple Adventure Game in C++ on Windows
  8. How To Simulate 3D Ball Physics In C++ Using OpenGL
  9. This Is How To Simulate Ball Physics 3D in A C++ App
  10. Learn To Simulate Realistic 2D Ball Physics in C++ Builder
  11. How To Simulate Realistic Physical Effects in C++
  12. Why You Should Know About Brute Force Methods in C++
  13. What Is The Metaverse And What Does It All Mean?
  14. How To Make Your Own Metaverse Using C++

A Complete Guide To Programming In C++ with More Examples and Snippets

All the graphics on our screens are basically results of math. If you are good at math, you can use mathematical functions, trigonometry, complex numbers, matrix forms and more. This skill helps you to develop amazing games, engineering simulations, visualization techniques but being ‘good at math’ is not required for most graphic operations, so don’t worry if math is not your strongest skill! Here are some of mathematical and graphical examples for you that can be used in game development, graphical visualization and simulations.

Math and Graphics

  1. Learn To Easily Develop A Fun Fibonacci Number Generator In C++ For Windows
  2. Tutorial: Learn To Print Mandelbrot In Text Form In C++
  3. Tutorial: Easily Learn To Draw Mandelbrot In C++ On Windows
  4. ASCII Art: Fun Code Spinning Donut In 3D Text Form In C++
  5. Tutorial: Learn To Sort Numbers With Bubble Sort Method In C++ On Windows
  6. Learn To Use Powerful Cryptographic Hash Functions In Modern C++ On Windows (SHA, SHA2, MD5, BobJenkins)
  7. What You Need To Use Complex Numbers in C++ Software
  8. Solve A 3 Diagonal Matrix Using Successive Over Relaxation
  9. Solve 5 Diagonal Matrices In C++ Software For Engineers
  10. Learn How To Write A C++ App To Solve A 7 Diagonal Matrix
  11. Why You Should Learn About Hilarious Hedgehogs In C++
cbuilder 11 512x5121x 5814924

C++ Builder is the easiest and fastest C++ IDE for building everything from simple to professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.

Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

Download RAD Studio 11 now

See what’s new in RAD Studio 11

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.