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?
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.
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.
Related
What graphics engine Maya uses, OpenGL or DirectX? Does it at all use any? Since maya is written in C++.
For going deep into Maya, is it proper to learn to use OpenGL or one should go with DirectX?
My questions specially are associated with adding super new functionalities, such as new edge-system for a certain geometry in Maya.
What graphics engine Maya uses
Its own.
Neither OpenGL nor Direct3D are graphics engines. They're drawing APIs. You push in bunches of data and parameters and shaders to make sense of that data, and rasterized points, lines and triangles on a 2D framebuffer come out on the other side. That's it.
Maya, like every other graphics program out there implements its own engine or uses a graphics engine library that maybe uses Direct3D or OpenGL as a backend. In the case of Maya OpenGL is used for the interactive display. But the offline renderer is independent from that.
For going deep into Maya, is it proper to learn to use OpenGL or one should go with DirectX?
As long as you don't want to write lower-level-ish Maya plug-ins, you don't have to learn either.
My questions specially are associayted with adding super new functionalities, such as new edge-system for a certain geometry in Maya.
You surely want to make that available to the offline renderer as well. As such neiter OpenGL nor Direct3D are of use for you. You have to implement this using the graphics pipeline functions offered by Maya and its renderer. Note that you might also have to patch into external renderers if you want to use those with your news edge features.
I decided to do some OpenGL programming on OSX. I created a small NSOpenGLView class in order for me to get an OpenGL view in cocoa.
From there my plan was to switch to C++ and create an object model to draw shapes. Having no interest in reinventing the wheel I decided to use glutWireSphere to represent my sphere class.
Interestingly XCode throws a deprecation warning for ~90% of all the glu and glut functions. Including the sphere function.
Is there an Apple library that provides primitives similar to Glut? Am I missing something? Is there a current HowTo for OpenGL programming on OSX (OpenGL >= 3.2)? I'm currently looking through the OpenGL Programming Guide for Mac but that doesn't seem to cover it. Googling it mostly returns IOS or old results.
Note: I don't want to force the compilation to 10.8. And I don't necessarily want to link external libraries like GLFW.
You might want to check out SceneKit if you can use 10.9+. It's a native Cocoa framework specifically designed for dealing with 3D rendering.
From the docs:
'Scene Kit is a 3D-rendering Objective-C framework that combines a
high-performance rendering engine with a high-level, descriptive API.
Scene Kit supports the import, manipulation, and rendering of 3D
assets without requiring the exact steps to render a scene the way
OpenGL does.'
In particular the SCNSphere class is what you'll be looking for.
And here's a nice scene kit intro by Big Nerd Ranch:
SceneKit in Mountain Lion
However, one thing to consider is that you'll end up with code that is not portable to other platforms as SceneKit is native to OS X (and eventually iOS). Frameworks like OpenGL, Ogre, Irrlicht on the other hand support many different desktop and mobile platforms.
By this I mean, does Cairo draw lines, shapes and everything using opengl acelerated primitives or no? and if not, a library that does this?
The OpenGL backend certainly accelerates some functions. But there are many it can't accelerate. The fact that it's written against GL 2.1 (and thus can't use more advanced features of 3.x or 4.x hardware) means that there is a lot that it simply cannot accelerate.
If you are willing to limit yourself to NVIDIA hardware, NVIDIA just came out with the NV_path_rendering extension, which provides a lot of the 2D functionality you would find with Cairo. Indeed, it's possible that you could write a Cairo backend for it. The path rendering extension is only available on GeForce 8xxx hardware and above.
It's nifty in that it's focused on the vertex pipeline. It doesn't do things like gradients or colors or whatever. That's good, because it still allows you the use of a fragment shader. Which means you get to do pretty much whatever you want ;)
Cairo is designed to have a flexible backend for rendering. It can use OpenGL for rendering, though support is still listed as "experimental" at this point. For details, see using cairo with OpenGL.
It can also output to the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG, and more.
Are there any C/C++ free cross-platform 2D oriented graphical game engines (for isometric game)?
I'm expecting following features from engine:
Window creation
OpenGL context creation and initialization
Resource management
Animated sprites
Particle systems
I've considered OGRE (seems to be 3D oriented), Irrlicht (much more than just graphical engine, and also 3D oriented), SDL (only low-level functions, no resource loading/management).
Could you please advise anything else?
Although it's not a full-featured game engine, SFML might suit your needs. Apart from window and OpenGL context creation it also provides 2D sprite functionality. Sprite animation and particle systems are not available out-of-the box but should be easy enough to implement on top of the existing features. Someone apparently already implemented an OGRE-like particle system in SFML.
SFML is distributed under the zlib/png license, which might or might not meet your definition of "free".
Where can i get some advanced game programming resources for c++?
At http://gamedev.stackexchange.com ?
More specifically, this question and lots of others tagged with c++
Start with writing some simple 2D games, e.g. Snake, TicTacToe, etc. Write these using any GUI builder you're already familiar with.
Then try to rewrite these games using a serious graphic engine, e.g. SDL, OpenGL, or DirectX.
Then try to write a more complex 2D games, e.g. side-scroller. Write these games with the graphic engine of your choice.
Then add some simple 3D effect to your 2D game, e.g. parallax scrolling.
Then rewrite this effect with true 3D, use 3D models/sprites, 3D environment, etc, while maintaining a 2D look and feel.
Then add some simple 3D look and feel, e.g. allowing characters to move in the Z-direction (to/from the camera), doing camera rotation, etc.
If you just got out of the command prompt and simple GUI, you'll probably want to start simple.
I'd very much recommend OpenGL as your API of choice. Since you've done some simple GUI programming, you'd know what an API is.
OpenGL has the following advantages (compared to SDL and DirectX previously mentioned):
-Its hardware accelerated (SDL is not as far as I know)
-Its 3D (SDL is 2D)
-Its cross-platform (DirectX is Windows only)
By far the best place to start with OpenGL is the Nehe tutorials.
http://nehe.gamedev.net/
Game programming becomes evident once you become a bit more familiar with the API.
Also, I'd heartily recommend GLUT (OpenGL Utilities Toolkit). It simplifies window creation and user input handling, among other things. Its great for learning OpenGL. It also happens to be cross platform.
Here's freeglut, a free GLUT implementation:
http://freeglut.sourceforge.net/
OpenGL is also a relatively simple and easy API to learn. You'll be going into 3D in no time.
What libraries are you using? You can try GP wiki. It can be a bit hit and miss depending on what you want to use.
By "resources," do you mean tools? Libraries? Tutorials? I have a bunch of useful game developer links in the sidebar of my own site. I also think "Mathematics for Game Developers" was very helpful. It has a second edition as well.