• Advertisement
Sign in to follow this  

Newb needs help, Dev c++

This topic is 4307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, im pretty new to c++ programming and need some help. Here are some questions i have. Im trying to make some simple openGl programs. All of this code i got from NeHe's tutorial's. When there is something like this
 AUX_RGBImageRec *LoadBMP(char *Filename) 
What do the * mean? Also, What exactly is this declaring, like bool, int or something like that
 HDC		hDC=NULL;							
HGLRC		hRC=NULL;							
HWND		hWnd=NULL;							
HINSTANCE	hInstance; 
1 more thing, What does the 256 mean? This is used for recieving keys for input.
 bool		keys[256]; 
Thx for the help

Share this post


Link to post
Share on other sites
Advertisement
No offence or anything, but did you just copy-n-paste and then modify to get your results?

I suggest you buy a good book and C++ and then come back to this stuff.

Share this post


Link to post
Share on other sites
You might need to read a little more about C or C++ (depending on which one you are using) before trying to understand the articles on NeHe. Anyway * is used to indicate a pointer, so LoadBMP returns a pointer to AUX_RGBImageRec. HDC, HGLRC, HWND and HINSTANCE is types used when programming in Win32, it's not native language types like bool and int. You generally use Win32 functions or parameters passed to WinMain to fill in these values. I seem to remember it's explained around lesson 3 (the lesson about getting started on Windows). And in your last question, the [] syntax means you are declaring an array so you are actually declaring 256 different bool variables, you can access the first like this keys[0] the next like this keys[1] etc.

Of course if you haven't read about these things before this is not enough to fully understand the features.

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
No offence or anything, but did you just copy-n-paste and then modify to get your results?

I suggest you buy a good book and C++ and then come back to this stuff.



I got the code from NeHe's tutorials.

I dont really want to buy a book because i think it's pretty pointless to spend 10$ on a book when there are plenty of tutorial's online. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by fitfool
Quote:
Original post by agi_shi
No offence or anything, but did you just copy-n-paste and then modify to get your results?

I suggest you buy a good book and C++ and then come back to this stuff.



I got the code from NeHe's tutorials.

I dont really want to buy a book because i think it's pretty pointless to spend 10$ on a book when there are plenty of tutorial's online. :)


The problem is that the NeHe tutorials isn't meant to be a starting point. If you insist on learning from the Internet (you can't keep doing this) then I suggest you search for "Thinking in C++", it's a pretty good free online book by Bruce Eckels.

Share this post


Link to post
Share on other sites
Quote:
Original post by CTar
You might need to read a little more about C or C++ (depending on which one you are using) before trying to understand the articles on NeHe. Anyway * is used to indicate a pointer, so LoadBMP returns a pointer to AUX_RGBImageRec. HDC, HGLRC, HWND and HINSTANCE is types used when programming in Win32, it's not native language types like bool and int. You generally use Win32 functions or parameters passed to WinMain to fill in these values. I seem to remember it's explained around lesson 3 (the lesson about getting started on Windows). And in your last question, the [] syntax means you are declaring an array so you are actually declaring 256 different bool variables, you can access the first like this keys[0] the next like this keys[1] etc.

Of course if you haven't read about these things before this is not enough to fully understand the features.


Thank you alot, This forum replies fast! :)

Oh yeah, 1 more n3wbish question, whe there is something like

 if (!Filename)                                   
{
return NULL;
}


does the ! before filename mean no?

Share this post


Link to post
Share on other sites
Learn C or C++ before OpenGL. The questions you are asking mean 2 things: 1. you have no idea how to program and 2. because of this, dont learn opengl, and do what the first sentence says. And Books are alot better because they are written in sequence by one author, so you should be able to take step after step really fluidly.

Share this post


Link to post
Share on other sites
Quote:
Original post by fitfool
Oh yeah, 1 more n3wbish question, whe there is something like

 if (!Filename)                                   
{
return NULL;
}


does the ! before filename mean no?


Yeah. ! means logicly not, so the above is 'if' it is 'not filename' 'return null' (or stop).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement