• Advertisement

Archived

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

Need help

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

Hi, I am using Dev C++ and i am trying to compile the simple triangle programm! but it gets errors! i am using the Dev C++ OpenGL Template. and when i try the nehe Triangle tutorial it gets errors. this is the nehe triangle tutorial. ***************************************************************** int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); glBegin(GL_TRIANGLES); glVertex3f( 0.0f, 1.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f); glEnd(); ***************************************************************** ***Thanks*** TeenProgramer

Share this post


Link to post
Share on other sites
Advertisement
"It gets errors" isn''t going to help us help you if you don''t tell us what those errors are.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
Sorry!
Ok, i only get errors when i make a function

such as " int DrawGLScene(GLvoid) { ....} "

It gets 13 Errors

My errors are somthin like hWnd undefined and Hdc and stuff like that, it also has a problem with the function
DrawGLScene(GLvoid)
and then it points to the stuff right below
the Triangle programm

here is a cut out of the Dev C++ Template

i will highlight the triangle programm

****************************************************************

// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );

// program main loop
while ( !bQuit ) {

// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {

// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
bQuit = TRUE;
} else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}

} else {

// OpenGL animation code goes here

****************************************************************TRIANGLE PROGRAMM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
****************************************************************

int DrawGLScene(GLvoid) { // Here''s Where We Do All The Drawing
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity();
glTranslatef(-1.5f,0.0f,-6.0f);
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glEnd();

}

****************************************************************
}
}

// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC );

// destroy the window explicitly
DestroyWindow( hWnd );

return msg.wParam;

}

TeenProgramer

Share this post


Link to post
Share on other sites
COOOOPY and PAAASTE the ERRRRORS.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
Here are all the Errors!

parse error before `{''
`hWnd'' was not declared in this scope
`hDC'' was not declared in this scope
`hRC'' was not declared in this scope
ANSI C++ forbids declaration `DisableOpenGL'' with no type
`int DisableOpenGL'' redeclared as different kind of symbol
previous declaration of `void DisableOpenGL(HWND__ *, HDC__ *, HGLRC__ *)''
initializer list being treated as compound expression
`hWnd'' was not declared in this scope
ANSI C++ forbids declaration `DestroyWindow'' with no type
`int DestroyWindow'' redeclared as different kind of symbol
previous declaration of `BOOL DestroyWindow(HWND__ *)''
parse error before `return''




TeenProgramer

Share this post


Link to post
Share on other sites
Alright. So what the compiler is telling you, is that you''re referring to variables, "hWnd", "hDC", and "hRC", that aren''t defined--or at least aren''t defined in a place where they''re visible to the function. Are you, perhaps, declaring those variables in a different function than the one you''re using them in?


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
See, this whole thing (Except the triangle programm) is a template that came with my compiler!

so i dont know.
i dont think so.

oh and when i take away the function and just type whats inside
the function it Compiles without errors!

but it wont display a triangle!


TeenProgramer

Share this post


Link to post
Share on other sites

  • Advertisement