math - How can I implement 3d graphics rendering in C with the SDL2? - Stack Overflow
3d graphics and animation
Getting started with Graphics in C
Can graphics be build from scratch using only C? - Stack Overflow
How is the 3D object displayed in C?
How is 3D shown on a 2D screen?
What is 3D rotation?
can i do some 3D Graphics and animation with c ??
I just got into programming with C (I have a pretty good amount of experience in other languages) and I am trying to start using graphics. This however, has proved quite the challenge. I can't seem to find a tutorial that covers everything when getting libraries to work with C. They are always like "Oh, just go and download MinGW32 and then you need to download GLUT also." But then never explain how to actually install both of those. Then when you look up tutorials for those they don't work with the original tutorial you were following. I see tons of people saying, "Oh, just go use SDL" but does not actually explain how to start using it.
If anyone could provide a detailed step by step guide or point me in the direction of a good tutorial that would be much appreciated.
Additionally, I am using Visual Code Studio on Windows 10
Yes you can do your own rendering engine (just google rasterization) in C alone without any libs however to output gfx to screen (or any other device) You have to interface with device and here OS/platform stuff goes in. I assume PC (x86)...
For example in old MS-DOS you could use BIOS (with few lines of inline assembly) and or use direct in,out functions (yes there where time that in,out was in C) however in nowadays C/C++ languages there is no in,out so you have to use assembly again. With such you could set up desired video or text mode and from there just use direct access to framebuffer on VGA (as simple as writing to array + some page flipping for bigger resolutions)
On modern OS is this no longer possible as all HW and Memory access must comply priviledges ... So in order to access gfx card you have to connect to gfx driver or write its own however that requires ring0 priviledges so you either need to create and install device driver (not easy and from win10 also not cheap and you need Driver SDK for that which is also sort of lib) or use universal driver like JUNGO or use OS and gfx vendor provided gfx api like OpenGL,DirectX,GDI however all of these are considered lib,api ...
The only workaround is use what you have at disposal which is text console output (text mode window or console) along with ASCII art.
see Display an array of color in C
If you are on MCU or whatever platform where you have unrestricted access then writing own driver is OK for example see:
- 2D,3D rendering engine for SSD1306 LCD
However writing driver for gfx on PC is not good idea as you would need to support all the gfx cards used and that is too much work (and you would have hard time to obtain relevant info needed to do it anyway) so in reality using existing gfx api along with existing drivers is the only way which means you HAVE to use libs/apis if you want "real" graphic...
I dont know about writing them without any libraries, because you will ultimately have to use some library to interface with the GPU for graphics. The most common graphics APIs for C and C++ are OpenGL and Vulkan, both being great hardware accelerated APIs developed by Khronos, with the latter being lower level than the former. There's also SDL which isn't hardware accelerated, but it is easier to use.
I know, it might be against the guidelines, but I would really appreciate if ou could provide anything on the topic, if source code can also be provided I'd be especially thankful.