Unable to proceed (Newbie)

Started by
3 comments, last by amreshr 23 years ago
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
dArkteMplaR of Delphi
Advertisement
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

--Spencer"All in accordance with the prophecy..."
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

--Spencer"All in accordance with the prophecy..."
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
dArkteMplaR of Delphi
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
--Spencer"All in accordance with the prophecy..."

This topic is closed to new replies.

Advertisement