Archived

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

Unable to proceed (Newbie)

This topic is 6112 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 very new to OpenGL and am trying to get my first program on OpenGL running and I facing a lot of problems in doing this under C++, both MS and Borland. I am able to compile it under VC++, but cannot run the code and am not able to compile it under BC++. Under Delphi I have no problems, but I want to do this under C++. Plese Help ===============This is the listing of my code========================================= #include
#include
void renderScene(void){ glClear(GL_COLOR_BUFFER_BIT);
glFlush(); } void setupRC(void){ glClearColor(0.0f, 0.0f, 1.0f, 1.0f); } void main (void){ glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); glutCreateWindow("Simple"); setupRC(); glutMainLoop(); } ======================================================================================== This is the problem that I get when I run the program that I compiled on VC++ 6.0. GLUT: Warning in (unamed): The following is a new check for GLUT 3.0; update your code. GLUT: Fatal Error in (unamed): redisplay needed for window 1, but no display callback. Press any key to continue ---------------------------------------------------------------------------------------- This is the problem that I get when I do this under the Borland command line compiler: Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland sb01.cpp: Turbo Incremental Link 3.0 Copyright (c) 1997, 1998 Borland International Error: ''D:\BORLAND\BCC55\LIB\GLUT32.LIB'' contains invalid OMF record, type 0x21 Normal Termination Output completed (0 sec consumed). ======================================================================================== Tia

Share this post


Link to post
Share on other sites
Hi.
I shall say that i am no expert on glut but worked with it so here follows:
everytime glut creates a window, it calles GlutDisplayFunc and GlutReshapeFnnc. You dont have these in your main file so here is what you can do:
add
glutDisplayFunc(pointer to a function)
glutReshapeFunc(pointer to a function)
befor the setupRC...

the reshape func has to have the following definition
void myReshape(int width, int height)
and the display has to have
void myDisplay()

these functions are called everytime the window needs to be redrawn or it is being resized respectively. get it?
also it might help to call glutInitWindowSize(width,height) after glutInitDisplaymode()

you might even want to call renderScene from the display function.
check out the glut manual for more details....

i hope this helps..please let me know if i have made some mistakes here

--spencer

Share this post


Link to post
Share on other sites
Hi.
I shall say that i am no expert on glut but worked with it so here follows:
everytime glut creates a window, it calles GlutDisplayFunc and GlutReshapeFnnc. You dont have these in your main file so here is what you can do:
add
glutDisplayFunc(pointer to a function)
glutReshapeFunc(pointer to a function)
befor the setupRC...

the reshape func has to have the following definition
void myReshape(int width, int height)
and the display has to have
void myDisplay()

these functions are called everytime the window needs to be redrawn or it is being resized respectively. get it?
also it might help to call glutInitWindowSize(width,height) after glutInitDisplaymode()

you might even want to call renderScene from the display function.
check out the glut manual for more details....

i hope this helps..please let me know if i have made some mistakes here

--spencer

Share this post


Link to post
Share on other sites
Tanx! a lot spencer. Now the program runs while using VC++. Can you tell me how to get this running using Borland C++ 5.5. I am using the command line compiler

Share this post


Link to post
Share on other sites
Glad it works...haha i acctually helped a person..feels good

sorry, but i cant help you with the borland issue, but maybe you want to check that youl link all nessecary libs...but i guess you do that

good luck

Share this post


Link to post
Share on other sites