how are graphic's API's created such as DirectX and OpenGL. And is using GDI which is the graphic portion of the winapi, a graphic API itself? or are you able to create your own with C++ for 2D rendering instead of using anyone elses. Or does writing an API involve assembly.

Recommended Answers

All 4 Replies

To my knowledge, both DirectX and OpenGL are written with C or C++. You could write an API like them yourself using C++. On Windows, you can use SetPixel() to set a pixel on a screen. I believe that's one of the most basic graphical functions you can use (in the Windows API). Then it's up to you to write bitmap loaders and the like.

so are directx and openGL just MASSIVELY modified versions of GDI with the winapi so that it can handle 3d rendering and all that good stuff.

I guess you could classify DirectX as that. OpenGL, on the other hand, is multi-platform, so it can't always be using the Windows API. I'm not sure how OpenGL handles being multi-platform. Perhaps the different versions of OpenGL for different platforms are coded slightly differently internally. I can't say for sure.

perhaps the drivers of graphics cards also used to know the right memory locations etc for directx and opengl...
at the end, GDI also has been made by man kind, so i think parts of some rlly low-level things are asm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.