is this enough ??

Started by
4 comments, last by Metal Typhoon 21 years, 10 months ago
is this enouth to start a triangle in opengl when a window is open ?? is it reliable ?? please help .. what about pixelformating ? i dunno why that is needed can someone explain me ??
  
//Global

HDC   hDc;
HGLDC hRc;

//in Win Proc under WM_CREATE :

case WM_CREATE:
{
  hDc = GetDC(hWnd);
  hRc = wglCreateContext(hDc);
  wglMakeCurrent(hDc,hRc);

  glClearColor(0.0f,0.0f,0.0f,0.0f);
  glClear(GL_COLOR_BUFFER_BIT);
  
  glBegin(GL_TRIANGLE);
    glVertex3f(-1.0,0.0f,0.0f);
    glVertex3f(0.0,1.0f,0.0f);
    glVertex3f(1.0,0.0f,0.0f);
  glEnd();
}
break;

//At WM_DESTROY


case WM_DESTROY :
{
   wglMakeCurrent(NULL,NULL);
   wglDeleteContext(hRc);
   ReleaseDC(hWnd,hDc); 

}    
break;  
Metal Typhoon
Advertisement
you should go to the Forums->openGL->NeHe Tutorials section of this site. it has everything that you need.

inedentally unless you are calling it elsewhere, you are not calling SwapBuffer() so you won't see anything.

-me

[edited by - Palidine on May 31, 2002 7:00:51 PM]
quote:Original post by Palidine
you should go to the Forums->openGL->NeHe Tutorials section of this site. it has everything that you need.

inedentally unless you are calling it elsewhere, you are not calling SwapBuffer() so you won''t see anything.

-me

[edited by - Palidine on May 31, 2002 7:00:51 PM]


you won''t see anytihgn until you SwapBuffer() ?? so everytime i''m drawing , i''m drawing it somewhere else to later SwapBuffer() again to see it ?
Metal Typhoon
no, you render the whole frame and THEN SwapBuffer(). since you were just drawing one triangle i suggested that i didn''t see the SwapBuffer.

but i digress. just start going through the NeHe tutorials. they are very clear. in fact the first tutorial is drawing a triangle.

-me
quote:Original post by Palidine
no, you render the whole frame and THEN SwapBuffer(). since you were just drawing one triangle i suggested that i didn''t see the SwapBuffer.

but i digress. just start going through the NeHe tutorials. they are very clear. in fact the first tutorial is drawing a triangle.

-me


i know but he adds to many error cheking... i just wnat to know if it run that way that was all thx for the reply
Metal Typhoon
errm, error checking is a GOOD thing, better to much on init than too little, you dont want your program falling over in a big heap, never assume its going to work, thats VERY poor programming practise..

This topic is closed to new replies.

Advertisement