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

# Graphics – A Complete Guide To Programming In C++

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.

## 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.

## 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

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.

## 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

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.

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

### 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.