Shoaib Ahmed
Shoaib Ahmed

Reputation: 41

SDL2 and 3D Rendering

Does SDL2 have the capability to render things in 3D (i.e. make cubes, spheres, etc.) without the use of OpenGL, or does it only have 2D capabilities?

Upvotes: 4

Views: 29719

Answers (2)

Nelfeal
Nelfeal

Reputation: 13269

Here's what the wiki has to say:

2D Accelerated Rendering

For advanced functionality like particle effects or actual 3D you should use SDL's OpenGL/Direct3D support or one of the many available 3D engines.

SDL does not aim to provide a 3D API, but gives you some support for other well-known APIs like OpenGL and Direct3D.

Note that SDL2 also provides Vulkan support.

Upvotes: 0

pr0f3ss
pr0f3ss

Reputation: 537

Your question would be better off on GameDev Stackexchange but to simply answer your question: SDL2 itself has no capabilities to render 3D objects. This is also stated in SDLs about page:

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D

SDL provides some functions to help you ease the use of OpenGL, but you'll have to learn and use OpenGL to allow rendering 2D and 3D vector graphics.

A good tutorial that I'd recommend on the basics of SDL is this site. It only has some chapters related to the use of OpenGL, but if you haven't used SDL much, this is a great start.

Upvotes: 6

Related Questions