I've done a lot of coding in C++/JavaScript/Python but want to make something which involves actual graphics.
Oh man, trying to decide what to do or where to start is pretty tough with this...
At first I thought "OpenGL!" but I've struggled to find comprehensive tutorials for versions more recent than 3.3. Considering it's no longer in development and at 4.5 right now I don't think that's too useful.
Second option is D3D11 (Not on Win10 so 12 is out of the option) . But for this my programs will need to be tied to Windows.
Then there's Vulkan... I have failed to find tutorials on this (basically at all) and am told that it is quite complicated.
Which should I learn? How will I go about learning it/them? Really in a rut with this...
(p.s. I'd be using C++ along side it)
Thanks!
~pip
I think openGL is still a great place to start.
Not only are there a LOT of basic concepts to be learned (vertex buffers, shaders, matrix math, etc) but openGL will remain to be supported for a long time. Even though it's not bleeding edge like Vulcan, you can still make stuff that'll run just fine now and for years to come.
I also imagine a lot of methods and concepts will translate well from openGL to vulkan. It's only a matter of time before there are great tuts for vulkan and opengl would be a good place to get started.
2 Likes
I'd definitely recommend OpenGL. There are many tutorials available for OpenGL3+. The best part about once you start learning, you should be able to create most graphical effects with relative ease.
Here's what I used/use to learn:
http://www.opengl-tutorial.org
http://ogldev.atspace.co.uk/
A really good video on lighting, once you need that:
I actually recommend the lighting video first. It's pretty interesting.
Anyways before you can use OpenGL3+ functions you will need a window and something to talk to your graphics driver. I use SDL for my window and GLEW for talking to my driver, but you can use any alternatives you like.
Sorry I'd elaborate more, but I'm at break at work and on my phone. I'll be on the forums more later if you want to post any questions.
1 Like
So I'm a little lost on a part of this that might just be general knowledge I'm missing: How do I get OpenGL & related libraries to be included in my code? Can I use a normal blank C++ file with the GNU GCC compiler?
The only library that is included by default in Code::Blocks is and for a windows manager. (If you start an OpenGl project specifically). I intended to follow the tutorial series Maxter linked to but the first tutorial starts with the tutor explaining how to get it to work in VS.
Thanks!
~pip
I'd gotten freeglut and glew, but I couldn't figure out how to add it to my C++ project or how to get the compiler/IDE to recognize it was there.
this is when you need the tuts :D
Hey, if you still need help getting FreeGlut and Glew setup in Code::Blocks, just tell me which OS and I'll do it myself. Then I'll post how to add the libraries and get it working here.
What is the compiler that you are using along with Code::Blocks?
Here are the correct downloads for FreeGLUT and GLEW.
I setup my project folder like this (by manually creating the folders):
Project/
Project/bin/
Project/bin/Debug/
Project/bin/Release/
Project/include/
Project/lib/
Project/obj/
Project/src/
I then extracted the "include" directories from both the FreeGLUT and GLEW archives into my project's "include" folder. I manually extracted the library files from the archives into my project's "lib" folder. I needed to choose the x64 variants, because my compiler toolchain is x64. I had to do the same for the required DLLs. My project looks like this now:
Project/
Project/bin/
Project/bin/Debug/
Project/bin/Debug/freeglut.dll
Project/bin/Debug/glew32.dll
Project/bin/Release/
Project/bin/Release/freeglut.dll
Project/bin/Release/glew32.dll
Project/include/
Project/include/GL/
Project/include/GL/freeglut.h
Project/include/GL/freeglut_ext.h
Project/include/GL/freeglut_std.h
Project/include/GL/glew.h
Project/include/GL/glut.h
Project/include/GL/glxew.h
Project/include/GL/wglew.h
Project/lib/
Project/lib/glew32.lib
Project/lib/glew32s.lib
Project/lib/libfreeglut.a
Project/lib/libfreeglut_static.a
Project/obj/
Project/src/
I then used Code::Blocks to setup an empty project (using the same project folder as above.)
I then right-clicked on my project and selected "Build options..."
Underneath "Linker Settings," in "Other linker options," I appended this:
"-Llib -lfreeglut -lglew32 -lopengl32"
Underneath "Search Directories" I added my "include" folder.
I added main.cpp inside of my "src" folder.
I was then able to build and run the project.
SDL or SFML are pretty good for simple 2D graphics but you can always grab the OpenGL context for 3D rendering.