Eclipse, OpenGL, MinGW?
Hello. I am intersted in writing C++ progams that can display simple lines or shapes that will represent some objects. For example, a grid that looks much like a crossword puzzle and an oject that occupies one of the squares, and this object will navigate from one end of the blank squares to another.
Anyway, I figure I need some graphics capability but graphics.c is out as I'm on a linux machine. I've been reading about openGL, MinGW for Eclipse and I have big trouble installing all this stuff correctly. I have installed Eclipse Luna and use it for Java and have the C++ CDT as well. But I don't have graphics capability. I want to draw simple two dimentional shapes. Can you tell me what I need to install, where to install or direct me to the correct instructions please? I have OpenSuse 13.1 |
For your specific use-case you probably go best with forgetting about OpenGL and just use a cross-platform toolkit, like Qt, it will give you all the capabilities you need.
|
Quote:
Quote:
Quote:
Compared to Qt it's a lot smaller and simpler because it doesn't include UI widgets (buttons, text boxes, etc). |
I'm a novice so I wouldn't take my advice as gospel but I am using Eclipse and Allegro 4. It's good for simple console programming and using graphics. (Similar to MS Graphics.lib) However learning from ground zero, I would suggest using Allegro 5. As I understand it, it's event driven.
Plus Allegro libraries can be used on both Linux and Windows. (I'm running a duel boot). Only thing to remember, if you want to run your game on machines without the Allegro library, you will need to compile your game with Allegro static library. In short, it makes your program bigger by including all the info needed to run your game independently. Again, I'm not an expert, but this should be enough info to Google the gaps. And send your game once you have it. :) Good Luck Ace |
If you want graphics capabilities in your C/C++ program, you need to use a graphics library.
But OpenGL is for 3D stuff, and GTK or Qt are for GUIs. So, for 2D graphics: SDL, Cairo, ... (others that I can't remember at the moment.) Googling 'LibSDL' and 'Cairo graphics' should give you relevant links. Once your choice is made, all you will have to do is install the development packages and read API docs. |
Quote:
But you are right, a specialized cross-platform library may be better here, depending on how complex the application is. |
This is just a learning tool for myself. I like to see results in graphical form.
The Cairo tutorial is very well written but the program code looks like a huge learning curve for me. Oh well, it's Sunday and it's sleeting outside - might as well. Trying to download, message says it's already installed. Now I wish I could just copy and psste a very simple program to see if it works. |
Quote:
Quote:
|
Here's what I get when trying to use GTK in a C program.
Code:
jay@bird:~/CPP> gcc `pkg-config --cflags gtk+-3.0` -o window-default window-default.c `pkg-config --libs gtk+-3.0` |
Have you installed the gtk3 dev packages?
Code:
sudo apt-get install libgtk-3-dev |
yes I have those.
|
What's the output of
Code:
pkg-config --cflags --libs gtk+-3.0 |
Quote:
Quote:
|
Here's the program I'm trying to run:
Quote:
|
Code:
jay@bird:~/CPP> gcc -o window-default window-default.c Code:
gcc -o window-default window-default.c `pkg-config --cflags --libs gtk+-3.0` |
All times are GMT -5. The time now is 03:52 AM. |