#### Archived

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

# is this enough ??

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

## 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 on other sites
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 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 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 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 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..

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
15

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009199
• ### Who's Online (See full list)

There are no registered users currently online

×