Jump to content

  • Log In with Google      Sign In   
  • Create Account

learning to render

  • You cannot reply to this topic
4 replies to this topic

#1 fraryskdesign   Members   -  Reputation: 136


Posted 30 August 2014 - 07:50 PM

I have been wanting to learn graphics programming for a while now but don't really know where to start. My first time even seeing graphics code was in Skyrim ENB mods (hlsl) which I have played around with a bit now. Sadly you are only limited to changing a few postprocessing effects for the game like: depth of field, bloom, color corrections and tonemapping. Those are all available through .fx files, the real meat and potatoes of the program is hiding in a .dll file.


So far this site has helped me in learning c# but I would really like to start doing 3d rendering. Unfortunately, the research I have done suggests to me that c# isn't a good language for this. OpenGL and DirectX don't tie in to c# without third party libraries like OpenTK (OpenGL) and SharpDX (DirectX) which I don't think using would benefit me in the long run. Instead c++ (which was discouraged as a first language on this site) is used with both OpenGL and DirectX. Now that I have learned a bit of c#, I am considering learning c++ to learn OpenGL or DirectX but I don't really know where to start.


Maybe someone on this forum has some suggestions for what I should do. 


Should I stick to c# for a while longer before attempting c++? (I don't really know the difference yet, I haven't looked into c++ much)


Should I start some c++ tutorials?


Should I start some GLSL/HLSL tutorials?


Should I learn c++ and GLSL/HLSL at the same time?




#2 Misantes   GDNet+   -  Reputation: 919


Posted 31 August 2014 - 12:07 AM

You'll probably get varying answers to whether or not you should jump into c++ yet. I'd say you're probably fine, but I don't know the depth of your c# knowledge, etc, etc. I'd say just make sure you're following recent c++ tutuorials/books as there are a lot of relatively outdated resources out there, and make sure you get a solid grasp of garbage handling/pointers at some point if you're going to use them (speaking from experience, I did not learn that properly, initially, and have recently had to go back and learn it again :P). I can't speak to directX, but I imagine the following advice will still apply.


I'm relatively new to both c++ and OpenGL myself, but I will say OpenGL was rather overwhelming at first, coming fresh from making 2D games. If you're going to go this route, I'd suggest getting a solild grasp on c++ with simple 2D games for a little bit before jumping into openGL. It should be relatively quick for you as a second language. But, you may find it a little daunting tackling both at the same time (you're likely going to want to learn glsl for shaders as well, which isn't all that different from c++ but there are little idiosyncracies and differences, plus just the overall method of making shaders. But, if you're really wanting to get into graphics programming, much/most of the magic happens there). But, all that together may be a poor idea.


Just perhaps be prepared for things to progress a little slower for you with 3D development. I know I personally, I felt there was a lot of "bang for the buck" when developing for 2D, where I could get functional games up and running rather quick and be relatively happy with how they've turned out. Learning how to get a 3D game looking how I'd like it has taken me much, much longer. I'm a good 3-4 months in to my current project (it's the one I started learning OpenGL with) and it's just now barely starting to resemble a functional 3D game. And, I spend a lot of time programming for a hobbyist (usually a  good 3-4 hours a day, most every day). But, the graphics pipeline is certainly a good deal more complicated than 2D development, and things will likely take a good deal longer. I think there's a reason most individual developers make 2D games.


But, it's totally doable, and certainly rewarding. Just don't expect to have Skyrim up and running by yourself anytime soon :P


All in all, I'd suggest learning c++ until you're relatively comfortable, then integrating OpenGL(or directX) for some simple window creating/object creation/textures/rendering/basic shaders etc and then when you're comfortable with all that digging into GLSL(HSLSL).


If you decide on opengl, when you're ready for it, http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/ is an invaluable resource for modern OpenGL (sadly, I don't have a great c++ one. There are so many out there and I don't have the perspective to recommend one over another). Though I do use:

http://www.cplusplus.com/doc/tutorial/ and http://en.cppreference.com/w/ when I do need to look something up.


Also, be careful to not follow/use any resources before opengl 3.3 as a ton of things changed with that version and try to stick to c++11 tutorials as well.


Good luck!

Beginner here <- please take any opinions with grain of salt :P

#3 HappyCoder   Members   -  Reputation: 2669


Posted 31 August 2014 - 10:59 AM

I would recommend learning DirectX 11. OpenGL is full of legacy code for backwards functionality. This means OpenGL will let you continue to do things the old way so you may be using functionally that has been outdated since the 90s.


Directx 11, on the other hand, has trimmed the fat and only offers an interface to graphics that is up to date. This will help you learn the more modern way of doing things. OpenGL will also have much of the same updated functionality but it is hard to know what is the state of the art in all of those API calls.


With modern graphics, there is a lot to take in. You will find you have to write a lot of code just to draw a single triangle. Don't be frustrated if you don't understand it all right away. Just try following some tutorials and get those working. Then start to play around with the tutorial code to get it to do what you want it to. You will learn as you experiment. If you have any questions or hit any roadblocks feel free to post your questions here.


Here are some good tutorials to get you started

Edited by HappyCoder, 31 August 2014 - 11:01 AM.

#4 Misantes   GDNet+   -  Reputation: 919


Posted 31 August 2014 - 01:08 PM

As to the DirectX vs OpenGL question, I think you'll also get varying answers to which should be preferred. I don't want to wade into to that too much other than to say to take time to consider for yourself the pros and cons of each. Typically, the most pressing issue is which platforms you want to develop for. If it's Windows only, DirectX may be your preferred option. Though, if you're considering developing for mac/linux as well opengl is considerably more cross-platform friendly. 


As to the legacy code, it's a valid point. Though, personally I don't find it too troublesome (though occasionally it is a minor issue) . C++ is similar in maintaining deprecated functions. As long as you're using up to date resources it shouldn't be too much of an issue. Though, I certainly see how it could be a concern.


Perhaps look into the pros and cons of each and see which will suit your needs better. This is one of those issues that I think the game development community has divisive opinions on and you'll get ten different answers if you ask ten different people. So, again, perhaps just do a bit of research and see what fits your needs :)

Beginner here <- please take any opinions with grain of salt :P

#5 TheChubu   Crossbones+   -  Reputation: 4403


Posted 31 August 2014 - 02:58 PM

Unfortunately, the research I have done suggests to me that c# isn't a good language for this. OpenGL and DirectX don't tie in to c# without third party libraries like OpenTK (OpenGL) and SharpDX (DirectX) which I don't think using would benefit me in the long run.
Have you looked at the differences between OpenTK/SharpDX and OpenGL/D3D? They're bindings, they're supposed to look like the API they're binding to. The calls are the same. The rendering techniques will be the same. I don't see this as a valid concern at all.



My journals: dustArtemis ECS framework and Making a Terrain Generator