some questions in Lesson one
i read the code of the Lesson One,and some of his wirting confused me. Listed below,can anyone give me answers? 1 Line 81: hRC=NULL; why dont wirte this without some those two IF sentence? 2 Line 124 & 129: why dont use 'wc.hIsntance=hIsntance' without 'GetModuleHandle(NULL)'? 3 Line 126: how about use the 'wc.lpfnWndProc = WndProc' instead of 'wc.lpfnWndProc = (WNDPROC) WndProc' 4 Line 125: without setting 'CS_OWNDC'? 5 Line 184: is there any differencs between the 'CreateWindowEx' & 'CreateWindow' the last one is how can i get some explains of the OpenGL's variable type,such as GLvoid
I don't use OpenGL, but I'll try to answer your questions:
Could you rephrase that? I dont understand your question. The two previous if statements will not prevent hRC from being set to NULL.
Because you would need to either pass the instance via a parameter, or have it global. I guess the former is a hassle, from the point of view of the author. The latter is rarely a good idea.
There's no need to cast it, it's already of the correct form. Note that in C++, you can assign a free-function pointer with or without the address-of operator.
I am no sure why exactly it is used, but perhaps it has to do with how OpenGL deals with device contexes in Windows.
Yes. CreateWindowEx() allows you to use the extended window styles.
I don't know. These typedefs are usually there to ensure platform-independence.
Quote:
1 Line 81: hRC=NULL;
why dont wirte this without some those two IF sentence?
Could you rephrase that? I dont understand your question. The two previous if statements will not prevent hRC from being set to NULL.
Quote:
2 Line 124 & 129:
why dont use 'wc.hIsntance=hIsntance' without 'GetModuleHandle(NULL)'?
Because you would need to either pass the instance via a parameter, or have it global. I guess the former is a hassle, from the point of view of the author. The latter is rarely a good idea.
Quote:
3 Line 126:
how about use the 'wc.lpfnWndProc = WndProc' instead of 'wc.lpfnWndProc = (WNDPROC) WndProc'
There's no need to cast it, it's already of the correct form. Note that in C++, you can assign a free-function pointer with or without the address-of operator.
Quote:
4 Line 125:
without setting 'CS_OWNDC'?
I am no sure why exactly it is used, but perhaps it has to do with how OpenGL deals with device contexes in Windows.
Quote:
5 Line 184:
is there any differencs between the 'CreateWindowEx' & 'CreateWindow'
Yes. CreateWindowEx() allows you to use the extended window styles.
Quote:
the last one is
how can i get some explains of the OpenGL's variable type,such as GLvoid
I don't know. These typedefs are usually there to ensure platform-independence.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement