EvilZone
Programming and Scripting => C - C++ => : pllaybuoy October 24, 2012, 01:04:08 PM
-
Anybody knows some good graphics library for somebody who's new to C++ oop ?
I tried graphics.h and constrea.h but they suck and moreover no compiler supports them because these files require other header files included which are rare ,I tried them with codeblocks and devcpp but can't get em to work , I really want to get into graphics but I guess QT and directX are way too advanced for me at this state , does anybody know anyother library ? Also is GLUT okay for beginners in graphics ? If so which compiler should I use for that and how do I configure it all? or suggest any other library that you think would be suitable
thank you :)
-
Actually, both GTK & Win32 API are relatively simple to work with. They are also very popular. There are a few others of note, as well; specifically wxWindows & fltk. Qt is actually not that difficult and it's probably the easiest to use with C++ whereas the others are typically more C-oriented. Qt can seem a little daunting at first, especially given its size, but there are many great beginning tutorials available. Of course, Qt is also considered one of the bigger/bulkier/heavier toolkits out there so if you're concerned for resource usage, it may be better to choose something else.
-
So summing it all up , from where shall I start , QT or win32 API ?
-
He did emphasize qt the most, but said all are doable. Make your own judgment.
-
I am going with win32 API then since I have friends who use win32 API , then maybe I 'll switch to GLUT ,GTK or QT .
-
That's a good choice and will be fairly useful down the road. Be sure to keep in mind that Win32 API is a C-based API. There are some things, like MFC, that offer C++ wrappers for the API but your best bet is to learn to use it directly. One of the more useful challenges is to create your own window wrapper class, paying close attention to its use in the main event loop.
-
I kind of disagree with you Xires. I don't see the point of using the WinAPI directly if you are not going to be coding a wrapper yourself or need low level control over your windows / application. I'd go for Qt or GTK because some talented people already did the C based work for you and your implementation is most likely not going to be as good. Yes there's the whole "you should learn about it first" point but over the years I kinda call that bullshit. Hell just go on and program your app in C# with nice looking windows and if you want keep the background work in C++.
I think every developer has its role and if you are the one working on the GUI shouldn't have to work with the Win API (anymore) because of all the wrappers and libraries that are available. It's the beauty of open source software and libraries.. Tons of people worked on them and they are (most likely) good enough for you. Why do it again?
However, if your goal is to be a C programmer focusing of WinAPI GUI libraries then of course this is the way to go.. but from what I've seen in your other posts / questions you are far from choosing something that specific right now.
-
Satan911; You are certainly right about some very talented people having done some great work on Qt & GTK. I didn't want to push any single toolkit over another but wanted to ensure that options were noted. However, I don't see the choice of learning Win32 API first as a bad one. I certainly don't think that it should stop there but there's nothing wrong with starting with it. As for the 'you should learn about it first' point; it's true that it's a very common point but I can't consider it entirely BS, though I think I understand where you're coming from.
Win32 API is used in lots & lots of software and especially in much of the underlying system software so learning it can provide a better understanding not only to what one currently wants to do but also in understanding better how the system itself operates and with that, what to expect with any software that you create for that system. I also have found, to my own experience, that it also helps with debugging, particularly when trying to work with things where you have no choice but to deal with the existing system. I feel that it provides a better general working set of information from which to begin building new knowledge.
Whilst that may seem vague, consider that when working with GTK or Qt, both of which provide their own canvas support for things like OpenGL & SDL and also provide some of their own methods for working with network connectivity, at some point you may still run into a problem that exists with how that toolkit deals with the system itself. During debugging, certain calls may be made to functions that are unfamiliar simply because they are not part of your toolkit but rather part of what your toolkit is working with. On the more hackerly side of things; if you want to create software that will try to read information from existing dialog boxes, perhaps password fields, that software is unlikely to be written in the same toolkit that you're using. Still, Win32 API isn't necessarily a better thing to learn first, and certainly not for everyone, but it's not a bad thing to learn at all. As well, if someone happens to already have other friends that are familiar with it, then there may be more motivation and support for learning it than other things that are not necessarily so well known.
Application development and, in a way, even system development offers more options to the learning programmer as they can learn new stuff and try to keep up with what's 'happening'. But for a hacker, if one should feel so inclined to follow such a path, it's pretty vitally important to know what already exists and what has become a 'standard'. Just because Boost exists does not mean that one should skip learning the STL.
On a side note: It's really good to speak to you again, even if we do differ in opinion sometimes.
-
I agree that there's no harm in learning the WinAPI first and it certainly has advantages. Your example about Boost and the STL made me rethink my position but I honestly I still think that in some cases you don't absolutely have to learn the deepest levels of how programs work to be a good programmer. Perhaps I haven't worked enough with GUI because I always thought working directly with the WinAPI was a waste of time and barely useful in many situations (GUI related). However there's some things Boost does really well, some it doesn't and that's why learning algorithms, data structures, etc. is important and that for any language.
Honestly I don't really disagree with any of what you said it's just that knowing the OP skills and (probable) intentions I don't see why he should go for the WinAPI but I realize that's a personal opinion. There are some fields where I think you need deep understanding in order to be a good developer in any language (again see data structures, algorithms) and some where you can just "trust" the work of other developers without really needing to understand it completely.
Good talking to you to. Been working on some projects, programming competitions and still trying to land an internship in the US next summer. Worked for a US company last summer but in a Canadian office.
-
SDL might be a good choice for a mix between low level and high level. It lets you use OpenGL but does a lot of the low level set up. I've used SDL frequently and it is a nice mix but not for everyone.
-
I seem to always have problems compiling SDL programs because you have to link to libs in a certain order or something. I don't know, it's been a while, but I would probably recommend SDL and gtk+ as they are the only ones I've ever used.
-
Holy S***!!!!!!! Satan911 && Bluechill in the same post??? Wow... mind == blown!!!! I never see you guys and now your both in one post...this must be a good topic ;)
@OP
I personally would go with Win32API because it's in so much use. Though I guess it depends on what your planning on doing with your coding skills. Do you want to code for open source projects? Do you want to reverse engineer stuff? Do you plan on finding exploits? Do you plan on writing programs and selling them online?
It really depends on what your looking to do, but Win32API is what you should go for if your looking to RE or do malware analysis or something of the sort. If your going for open source *nix projects though then the Win32API is worthless to you. Think about it and pick one, good luck man :)
PS
Sorry for weird spelling/grammar. I tried some new stuff today and I'm kinda messed up haha, typing is difficult as is coherent thoughts.... <3
-
Only post in the programming boards when topics are interesting ;)
-
Only post in the programming boards when topics are interesting ;)
This pretty much. I rarely post unless there is a good reason for me to do so.
-
I seem to always have problems compiling SDL programs because you have to link to libs in a certain order or something. I don't know, it's been a while, but I would probably recommend SDL and gtk+ as they are the only ones I've ever used.
You shouldn't have to link the libs in a certain order. I've used SDL on OS X, Linux, and Windows and I've never run into that issue. I have run into issues about linking debug libraries with non-debug libraries etc. which has led to problems but that's not an order thing. Basically if you're getting weird errors related to SDL, make sure if you're using a debug version of your program, you use a debug version of SDL which has linked with the debug std/win32 libraries etc. Same thing goes for release libraries, make sure you're only linking with release libraries. Windows has incompatibilities between regular (non-debug) libraries and debug libraries as their representations are completely different and incompatible with one another.
-
I just want to enter into GUI , though my aims are really high like making music players or 3d games so well you know ..some people have even suggested me GLUT and others QT , I can't go with QT , damn that 4gb download :/
-
I just want to enter into GUI , though my aims are really high like making music players or 3d games so well you know ..some people have even suggested me GLUT and others QT , I can't go with QT , damn that 4gb download :/
Don't use GLUT nor QT. They're, in my opinion, quite bloated and include too many things you don't need. I also don't like boost either so yeah :P but start out with something like SDL which is a good compromise and then move down to win32 or pure C/OpenGL or something or even DirectX.
-
Don't use GLUT nor QT. They're, in my opinion, quite bloated and include too many things you don't need. I also don't like boost either so yeah :P but start out with something like SDL which is a good compromise and then move down to win32 or pure C/OpenGL or something or even DirectX.
wikipedia says its for C , does it have support for c++ ? I mean the OOP part c++ at its originality , I dont want to go with C in any case thats hell too messed , and for real ? its used in macs,playstations,games and androids ? o.O Now this is something
-
wikipedia says its for C , does it have support for c++ ? I mean the OOP part c++ at its originality , I dont want to go with C in any case thats hell too messed , and for real ? its used in macs,playstations,games and androids ? o.O Now this is something
SDL, OpenGl, DirectX, Win32, they're all for C but that doesn't mean you can't use them in C++. GLUT is also for C. Yes, they're not object oriented (except win32 which does nasty oop in C) but they're still very good. And you should know how to use C libraries in C++ if you really want to become a good coder.
-
SDL, OpenGl, DirectX, Win32, they're all for C but that doesn't mean you can't use them in C++. GLUT is also for C. Yes, they're not object oriented (except win32 which does nasty oop in C) but they're still very good. And you should know how to use C libraries in C++ if you really want to become a good coder.
Honestly speaking I don't even know what a 'library' is , I am studying from primer plus 6th edition and em on the OOP chapters now , I have known header files , multi file compilations , namespaces and classes but have never encountered anything called a LIBRARY , I don't even know to include a library neither I know where to GET any libraries :/ Yes this is stupid but can you please guide me on where to get the libraries you suggest me to learn and how to include those libraries ? :|
-
Yes this is stupid but can you please guide me on where to get the libraries you suggest me to learn and how to include those libraries ? :|
This (http://www.libsdl.org/) is the SDL website.
(This is only my bare understanding of it)...
When linking to a library, you #include it in your code, it can be anything from math.h to SDL/graphics.h or something similar to that, but the tricky part is when you come to the actual compilation of the program. For math.h it is just -lm because you are going to use the -l flag for Library and what library you're going to link to... that one's called *M*ath, so we'll use -lm.
I would suggest crafting a compile command once, and then putting it in a Makefile. it's a whole easier to type "make" rather than gcc etc...etc... over and over again.
Here (http://wiki.libsdl.org/moin.cgi/FAQLinux#How_do_I_add_SDL_to_my_project.3F) is another way you could link to the SDL libraries by using a Makefile, but it uses another (easier) approach by using cflags and such... I haven't had the need for that yet except when messing with geany. Good luck on your adventures with SDL ;)
-
Honestly speaking I don't even know what a 'library' is , I am studying from primer plus 6th edition and em on the OOP chapters now , I have known header files , multi file compilations , namespaces and classes but have never encountered anything called a LIBRARY , I don't even know to include a library neither I know where to GET any libraries :/ Yes this is stupid but can you please guide me on where to get the libraries you suggest me to learn and how to include those libraries ? :|
Based on that post right there I would say avoid GUI for now man. You really need to finish the book, then read another book or two, as for libraries....it's in your book if it's a good book. and if it's not, google has the answer for you my friend.
I would recommend reading "Absolute C++" as well (really good for learning OOP in C++) and check out "writing great code" as well. Pretty interesting read.
Also, don't just read the book and do the examples they have in there. You really need to feel so comfortable with C that if I ask you to wright a CLI application for me you can do it. In fact heres a few projects I had to do for my C++ class:
*Computer picks a number between 1-10. Player then guesses, if the guess is too high or too low then the computer says so and
prompts the player to guess again. If the guess is correct, then the game displays a winning message and ends.
//This makes use of the random number generator which comes from a specific library in C++
*
Store simulator, 5 products with descriptions. You can then buy the products and have the customer "pay" you for them.
Don't let them leave until they have completely paid for the product. If they pay to much give them change, if they pay too
little then make them pay the balance. After payment is complete, provide them with a receipt.
*
A basic MUD game. Give your player minimum 5 rooms to explore, give them something like money or items or luck or health that
the game has to keep track of.
These should get you started man, remember just reading isn't enough. It takes practice to program well and feel comfortable
in a language.
-
Based on that post right there I would say avoid GUI for now man. You really need to finish the book, then read another book or two, as for libraries....it's in your book if it's a good book. and if it's not, google has the answer for you my friend.
I would recommend reading "Absolute C++" as well (really good for learning OOP in C++) and check out "writing great code" as well. Pretty interesting read.
Also, don't just read the book and do the examples they have in there. You really need to feel so comfortable with C that if I ask you to wright a CLI application for me you can do it. In fact heres a few projects I had to do for my C++ class:
*Computer picks a number between 1-10. Player then guesses, if the guess is too high or too low then the computer says so and
prompts the player to guess again. If the guess is correct, then the game displays a winning message and ends.
//This makes use of the random number generator which comes from a specific library in C++
*
Store simulator, 5 products with descriptions. You can then buy the products and have the customer "pay" you for them.
Don't let them leave until they have completely paid for the product. If they pay to much give them change, if they pay too
little then make them pay the balance. After payment is complete, provide them with a receipt.
*
A basic MUD game. Give your player minimum 5 rooms to explore, give them something like money or items or luck or health that
the game has to keep track of.
These should get you started man, remember just reading isn't enough. It takes practice to program well and feel comfortable
in a language.
I guess you're right ,maybe I should practice OOP and practical programming more before getting into GUI , the building won't be any better if the foundations are weak , thanks :)
-
I guess you're right ,maybe I should practice OOP and practical programming more before getting into GUI , the building won't be any better if the foundations are weak , thanks :)
No problem man. Glad I could help :)
-
Try looking into FLTK, there's a whole tutorial on that.
I use that, along with xming and putty to run my GUI C++ programs. Works great too.
Let me know if you want me to supply you my header and cpp files as reference to get you started.