Curious to what GUI framework are recommended by any C++ programmers out there. QT, OpenGL, or something completely different.

Well I only can programme with C (currently) but I write the code out and use compilers. If you decide you want to use one I know the compiler I use currently (gcc) is the most recomended and widly used complier.
other than that I can not be of much help.
other than that I can not be of much help.
I'm using OpenGL with python for my game. It's a pain to work but at least it is fast.
I use Dev C++ which I think uses gcc.Tretarn wrote:Well I only can programme with C (currently) but I write the code out and use compilers. If you decide you want to use one I know the compiler I use currently (gcc) is the most recomended and widly used complier.
other than that I can not be of much help.
I'll give it a look. I only know some basic C++ but am steadily making progress.CrytekUK.info wrote:I'm using OpenGL with python for my game. It's a pain to work but at least it is fast.

OpenGL has one good thing about it. It doesn't rely on many programming features. It's basically a bunch of function calls. It isn't object based. That also means it's easy to understand OpenGL from many examples in different languages. Converting Python OpenGL code to C++ OpenGL code is simply done by adding ";" on the end of all functions most of the time. If you struggle with it, I may be able to give limited help but I'm new to it as well.
I'm trying to use pyglet right now. I'm getting errors with the cTypes module. It doesn't like my integers anymore after implementing pyglet. This is for the second parameter of glBindFramebufferEXT(). :?
I'm having trouble with functions...
When I do this:
Perimeter always equals 0. But if I move "perimeter = Perimeter(len,wid);" to here:
It works. So I figured out the problem (by debugging
) but I don't know why it now works. Any info would be appreciated. 
When I do this:
Code: Select all
#include <iostream>
using namespace std;
unsigned long int Perimeter(unsigned short int len, unsigned short int wid);
int main()
{
unsigned short int len = 0;
unsigned short int wid = 0;
unsigned short int perimeter = 0;
perimeter = Perimeter(len,wid);
cout << "Please enter a side length...\n";
cin >> len;
cout << "Now a side width...\n";
cin >> wid;
cout << "Thanks!\n";
cout << "The perimeter is: " << perimeter << "\n";
char response;
cin >> response;
return 0;
}
unsigned long int Perimeter(unsigned short int len, unsigned short int wid)
{
return (2*len) + (2*wid);
}
Code: Select all
#include <iostream>
using namespace std;
unsigned long int Perimeter(unsigned short int len, unsigned short int wid);
int main()
{
unsigned short int len = 0;
unsigned short int wid = 0;
unsigned short int perimeter = 0;
cout << "Please enter a side length...\n";
cin >> len;
cout << "Now a side width...\n";
cin >> wid;
cout << "Thanks!\n";
perimeter = Perimeter(len,wid);
cout << "The perimeter is: " << perimeter << "\n";
char response;
cin >> response;
return 0;
}
unsigned long int Perimeter(unsigned short int len, unsigned short int wid)
{
return (2*len) + (2*wid);
}



I think what you've done is quite simple but my C++ syntax knoledge is non existant. But I think its similar to C.
Anyway, in code 1 you call on the function right away, which then returns a value based on length and width. However, you have not let the user define those yet, so the computer just takes them to be thier origional value, 0. However this should have atleast returned a value of 4, as (2+0) + (2+0) = 4.
In code 2 you let the user define the values before calling on the function, giving the correct value.
Hope this helps.
Anyway, in code 1 you call on the function right away, which then returns a value based on length and width. However, you have not let the user define those yet, so the computer just takes them to be thier origional value, 0. However this should have atleast returned a value of 4, as (2+0) + (2+0) = 4.
In code 2 you let the user define the values before calling on the function, giving the correct value.
Hope this helps.
That does help but what I still don't understand is that
doesn't do anything but set the value of perimeter. So then why does it go ahead and run the function? Is it just because the parameters have not been set so that variable perimeter can't really be defined yet?
Code: Select all
perimeter = Perimeter(len,wid);

Perimeter(len,wid) is a function call. That means it will pass the arguments len and wid to the Perimeter function and run it with those arguments. The function then returns a value. Your original code called the function before you set the len and wid variables with cin, hence the function ran with the arguments set to zero and gave 0 as the result.
Thats exactly how I would call on a function in C. What your saying is
perimeter = the result of the function
so the compiler will run the function immediatly on seeing this to find the perimeter. It will then use any values already defined before this point in the calculations.
I miss read the * sign before. so actually the calculations will be:
as your values are defined as 0.
perimeter = (2*0) + (2*0) = 0
but when you moved it downwards, you gave the compiler a chance to see the user defined values and the calculations come out as intended.
perimeter = the result of the function
so the compiler will run the function immediatly on seeing this to find the perimeter. It will then use any values already defined before this point in the calculations.
I miss read the * sign before. so actually the calculations will be:
as your values are defined as 0.
perimeter = (2*0) + (2*0) = 0
but when you moved it downwards, you gave the compiler a chance to see the user defined values and the calculations come out as intended.
beat me to itCrytekUK.info wrote:Perimeter(len,wid) is a function call. That means it will pass the arguments len and wid to the Perimeter function and run it with those arguments. The function then returns a value. Your original code called the function before you set the len and wid variables with cin, hence the function ran with the arguments set to zero and gave 0 as the result.

So the defining of perimeter takes the variables that are already available? That would make sense to me 


yeah, it'l take anything defined up to that point, sometimes when you forget to define a variable your complier might take some random memory addresses, so you end up with some crazy outputs.
Core dumps(aka segmentation faults) are also fun.
Core dumps(aka segmentation faults) are also fun.
Defining the function at the bottom doesn't run the function at the bottom. Functions are only run when they are called with the syntax function_name();Scott wrote:So the defining of perimeter takes the variables that are already available? That would make sense to me
Well core dumps aren't the same thing as segmentation faults but I can see possibly why you'd want to dump the memory if you got a segmentation fault.Tretarn wrote:Core dumps(aka segmentation faults) are also fun.
If you get a segmentation fault, it's probably due to an overflow of an array. Simple debugging of the application can solve these errors.
You need to be careful with overflows because they an cause security problems with your applications.
C++ should have some form of overflow protection. I don't know why it's so widely used because of this. I have heard of some compilers that analyse code for potential overflow errors but I don't think they are widely used and can't protect against variable inputs.
Modern operating systems have memory protection but there are huge security risks when operating systems have overflow problems.