I wanted to start on a little project of making a simple 3d engine, but I can't seem to find anywhere how 3d engines actually make frames. (I don't mean the math behind the 3d projection). Do they use bitmaps and edit the pixels, or do they use the GPU in some way? Also is editing the pixels in a bitmap using CPU or GPU?

I only mean after they do the math and find each pixel value for the frame how do they display the frame? Do they change the pixels in a bitmap while rendering a scene, or do they have an array that has all the pixels color values then use the GPU do display the pixels?

  • 2
    \$\begingroup\$ Rather broad question. The rendering pipeline overview on the OpenGL wiki might be a good introduction. \$\endgroup\$
    – Anko
    Sep 20, 2015 at 0:58
  • \$\begingroup\$ It can be very similar from one engine to another. It could take a little book to answer completely. As @Anko suggested, you should take a look at some documentations than could explain you how complex it can be. \$\endgroup\$
    – Aracthor
    Sep 20, 2015 at 1:30
  • \$\begingroup\$ After setting all the pixels they just call SDL_GL_SwapBuffers or wglSwapBuffers or glXSwapBuffers (depending on platform). The GPU has already set the pixels in a big array called a back buffer. \$\endgroup\$ Sep 21, 2015 at 0:19

2 Answers 2


This isn't too complex. In fact, it behaves a lot like a 2D game does.

When a 3D engine renders a frame, it typically does so in stages. Sort of like photoshop really. And this can happen either on the CPU or the GPU. For most game engines, it's now the GPU that handles this.

So... the engine first creates what is called a "Swap Buffer". It is basically a contiguous block of memory (holds two frames) that our final image will be rendered into. When the frame is finished, the game engine will swap it with the old frame.

When the game renders, it's usually done in multiple passes. These passes will be basically screenshots that the engine will use. So in a way, yes you are creating RGBA pixels, and then you edit them.

Each of these passes will be seperate pieces of the same scene. So... Albedo, lighting, shadows, depth, ect.

The engine will then composite all of these together into the final image.

  • \$\begingroup\$ So does it basically create a frame then display it when the next frame is being made? \$\endgroup\$
    – NoahGav
    Sep 20, 2015 at 14:18
  • \$\begingroup\$ Yup. You got it. \$\endgroup\$ Sep 20, 2015 at 18:49

All the projection and rendering is done on the GPU. When loading a level, the CPU reads meshes and textures from disk and uploads it to video memory of the GPU. In return, it gets integer numbers to later address those resources.

Every frame, the CPU sends commands to the GPU like "use mesh number 4 with texture number 7 and draw it". It also sends some data like the projection matrix and mesh positions. However we don't want to send more than needed every frame since the PCIe connection the the GPU is relatively slow.

When the GPU performs the rendering, the screen image is just treated like a texture of the size of the window internally. In fact, many engines draw to multiple textures in order to create more advanced graphics effects. Then, it is just another command that tells the GPU which image to send to the monitor.

By the way, the engine provides the code for both CPU and GPU (in form of shaders).


Not the answer you're looking for? Browse other questions tagged .