PDA

View Full Version : VC compiler error



02-15-2001, 08:44 PM
error C2054: expected '(' to follow 'WINGDIAPI'

and the line containing error is in gl.h:

WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);

which I never touched!

Please tell me how to correct this.

Deiussum
02-16-2001, 05:37 AM
If you had done a search on the form before asking this, you would see that this is a simple newbie error. You need to #include <windows.h> BEFORE GL/gl.h.

For future reference, if you ever see errors near things that are not simple types (int/char/float/etc.) the first thing you should check is what header has that type defined and make sure it is included before the error.

02-16-2001, 04:34 PM
yeah i am new in openGL.

one more question.

how to Clear the hidden surfaces?
Is there any requirement as to where to put the glClear(GL_DEPTH),glEnable(GL_DEPTH),in reshape() or in display()?

Deiussum
02-17-2001, 09:59 AM
Obviously somewhat new to C/C++ as well or you would have realized what the error was telling you. http://www.opengl.org/discussion_boards/ubb/smile.gif

You usually clear the depth buffer when you clear the screen before rendering a frame. You would put glEnable(GL_DEPTH) somewhere in your initialization code and to clear the depth buffer you use glClear(GL_DEPTH_BUFFER_BIT) not glClear(GL_DEPTH).

To clear both the color buffer and the depth buffer at the same time do glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);