I'm about to begin developing an application that requires some basic 3D rendering, so I'm looking into C++, as this seems to be the usual language for this type of thing and I have a book to help me with this project that includes some snippets of C++ code (not essential that they are understood, just useful). I plan on developing everything myself without the use of libraries like openGL (like I said, the objects and materials will be very simple).

However, I don't know any C++, but am familiar with many other languages (if C++ turns out to be impractical I shall use Java). How long would it take to learn and could I learn as I go along? I can compile and run very simple files, but I don't know how difficult producing a project would be and about dependencies and libraries I need (basic libraries only). Also, I would like to know if I can develop and do some testing on Linux even though my final program will be for Windows. Do I just need to change compiling settings depending on which OS I will be using?

Thanks in advance.

Recommended Answers

All 8 Replies

Hi Zyxl, welcome at DaniWeb :)
You cannot learn a language from a book alone. You learn the most by doing a project.
But if you just start a new language, don't directly start with trying to write the next fancy 3D rendering program in it.
Start small, to get the hang and feel of it.
Why not start with a "Hello world!" program.
Don't think that's a waste of time!
You learn alot in just doing that: A feel of the syntax, how to compile etc.

Thanks for your reply. I actually already made a hello world program and had a bit of trouble just getting GCC to work in Windows; I am concerned that more of this type of awkward thing may be needed when I intend to create a user interface, specify pixels or connect to a database. I wasn't planning on learning from the project alone, its just that I won't have much time to learn anything other than the essentials of what I need for this project (which includes OOP and possibly using utilising a database) and don't want to realise half-way through that things I coded at the start could have been done in a more scalable way (as I am realising in another project where I didn't know the API before starting). Because of this I will probably use Java because I am familiar with it and it handles things such as garbage collection for me (unfortunately performance will be worse and I might not get as much recognition for the complexity of the project - I'm trying to score marks by the way, but there is a real client). However, I would not like to rule out C++ yet because learning it would be useful in future.

Sounds exciting. I would recommend finding walkthroughs if there are any for your working environment I assume, non Windows world.
I love C++, so powerful and fast. Check out a lot of the available frameworks and libraries that people have built in C++ to speed up your development, why reinvent the wheel?

Good luck. Have fun!

I was going to use Eclipse with CDT encase you were wondering, as I can use this on Windows and Linux. Also, I'm reinventing the wheel in order to obtain more marks, plus I really love the mathematics and don't want libraries to take the fun away!

LOL, you sound like me. My preference too unless I would waste more time reinventing the wheel than I would on the rest of the car.

Is anyone able to answer my question about compiling for multiple operating systems?

Mathematics is the least of your worries if you are planning on using no libraries whatsoever. Especially where graphics is concerned!

In C++ there is nothing in the standard library that can deal with graphics, so you would literally have to write everything yourself. You'd need to do a lot of low-level programming, interfacing directly with the hardware or its drivers in order to do anything graphical. And if you know nothing about C or C++, then that will only compound matters!

I'd say that you are definitely going to need to use some 3rd party libraries. At the very least, you'll need OpenGL. It's pretty much a de-facto standard nowadays for graphical apps - especially if you want to develop cross-platform programs.

To develop your own low-level graphics library to replace OpenGL would take an extremely long time unless you are some kind of brilliant programming prodigy! (Not to say that you aren't, merely pointing out that this would not be a trivial thing to implement!)

But there is nothing to stop you from building your own engine on top of GL.
For example:
All cross-platform game engines (at least all of the ones I am aware of) use openGL for all of the low-level graphics stuff. But they create their own APIs to abstract things away in their engine; making it easier for programmers use their library to work on games/applications at a higher level of abstraction than with GL.

WRT compiling for multiple operating systems, there are a number of things to take into consideration. This isn't a comprehensive list but things like:

  1. You should use strict, standard compliant C/C++ syntax, without using extensions to the language that are compiler specific. Basically, pick an ISO standard definition of the language and stick to it throughout.

  2. Use conditional compilation (with pre-processor macros) to isolate any platform specific #includes or other sections of platform specific code.

  3. Any 3rd party libraries you use in your application must be available for all of the platforms that you want to compile the program on. So use common, cross-platform libraries like OpenGL, OpenAL, openMP, FreeType, SDL, Boost, QT, wxWidgets, MySQL etc etc..

  4. Use a modern build system like CMake to allow you to setup/configure builds for different platforms more easily.

Once you have your build system set up in the source-tree (via CMake scripts), you should be able to compile your program on any machine running one of your target platforms.

To compile binaries for all target platforms from a single machine would require you to set up some kind of cross-compilation environment. I've never tried this, so I don't know a lot about it. But someone else here might have had some experience.

As I say, I've never done any cross-compiling, but I have worked on a few cross-platform programs in the past. And offhand, the above points are probably the most common things to bear in mind when creating cross-platform applications. And if there is anything else that I have forgotten, I'm sure someone else here will chip in with more info!

Thanks, JasonHippy; you were very informative.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.