Hi every1;
Ok, im done on reviewing vector math.
now im reading this code in this book"game programming with opengl". i have 3 questions for three parts.
i broke the parts in 3 sections.
question 1:is this device context similar in concept to the hdc memory context that we create in win API to write onto (like inCode:HDC g_HDC //global DC
DDB bitmap functions , bitblt ,,stretchblt)?
question 2: why there is no ReleaseDC(hwnd, hdc); functionCode:HGLRC hRC; HDC hdc; //////////// case WM_CREATE: hdc = GetDC(hwnd); g_HDC = hdc; SetupPixelFormat(hdc); hRC = wglCreateContext(hdc); wglMakeCurrent(hdc, hRC); return 0; break;
in the above code. as its routily done in win API?
then in the body of opengl code during rendering phase we have:
*if answer to question 1 is yes disregard this one.Code:////////////// glTranslatef(,,,,,,,,,,,,,); glRotatef(,,,,,,,,,,,,,,,,,); glColor3f(,,,,,,,,,,,,,,,,,,); glBegin(GL_TRIANGLE); glVertex3f(,,,,,,,,,,,,,,,,) glVertex3f(,,,,,,,,,,,,,,,,) glVertex3f(,,,,,,,,,,,,,,,,) glEnd(); SwapBuffers(g_HDC); //bring back buffer to forground TranslateMessage(&msg); DispatchMessage(&msg); ///////////////////////////
question 3: why couldnt we simply make hdc global like;
HDC hdc;
and use it throuout the program so we dont need a second copy of it as g_HDC .? is it because we have to have 2 different device context , one for window procedure and one for opengl calls
.so how come they are identical?
why there is no ReleaseDC function for g_HDC neither?
thanks
silver or travis should know these.