Valtsuh
Valtsuh

Reputation: 11

Why is SetPixel so slow and are there any alternatives to it?

I've gotten up to the part where lots of drawing is going on, but the more objects I add to draw, the laggier my program gets. Such as simple squares or rectangles, objects simultaneously 1 - 256.

I've googled some and most suggest including a graphics library, but what if I wanted to create my own graphcis library?

Any help / examples appreciated.

Edit:

#include <iostream>
#include <fstream>
#include <Windows.h>

Upvotes: 0

Views: 324

Answers (1)

MSalters
MSalters

Reputation: 179779

SetPixel is a GDI function. Games typically use DirectX, which is quite a bit faster. Modern GPU's work best if you can express your drawing in terms of triangles and textures.

Upvotes: 1

Related Questions