Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Metal Typhoon

is this enough ??

This topic is 5918 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

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;  

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!