PhilMag
09-01-2002, 11:46 AM
I wonder if someone can help me....
I am trying to learn about OpenGL to prepare for my computer graphics course at uni next year. Today I dled the Borland C++ compiler for win98 and followed the instructions to set it up (putting gl.h, glu.h, glut.h in include/gl dir, glu32.lib, opengl32.lib, glut32.lib in lib dir and glu32.dll, opengl32.dll and glut32.dll in windows/system). I made myself a bcc32.cfg file:
-I"c:\Progra~1\Borland\Bcc55\include"
-L"c:\Progra~1\Borland\Bcc55\lib"
-W
and an ilink32.cfg file:
-L"c:\Progra~1\Borland\Bcc55\lib"
and put them in the bin dir.
I also set the PATH variable correctly.
To test that I had set everything up properly I copied a simple program from a book:
#include <windows.h>
#include <gl/gl.h>
#include <gl/glut.h>
//<<<<<<<<<<<<<<<<<<<<<<myInit>>>>>>>>>>>>>>>
void myInit(void)
{
glClearColor(1.0,1.0,1.0,0.0); //set white bg colour
glColor3f(0.0f, 0.0f, 0.0f); //set the drawing color
glPointSize(4.0); //a dot is 4x4 pixels
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
//<<<<<<<<<<<<<<<<<<<<<myDisplay>>>>>>>>>>>>>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT); //clear the screen
glBegin(GL_POINTS);
glVertex2i(100, 50); //draw 3 points
glVertex2i(100, 130);
glVertex2i(150, 130);
glEnd();
glFlush(); //send all output to display
}
//<<<<<<<<<<<<<<<<<<<<<main>>>>>>>>>>>>>>>>>>
void main(int argc, char** argv)
{
glutInit(&argc, argv); //init the toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); //set display mode
glutInitWindowSize(640,480); //set window size
glutInitWindowPosition(100, 150); //set window position
glutCreateWindow("my first attempt"); //open screen window
glutDisplayFunc(myDisplay); //register redraw fn
myInit();
glutMainLoop(); //go into a perpetual loop
}
I saved this as DrawDot.cpp.
When I attempted to compile the program in dos (bcc32 DotDraw.cpp) I got the following error "Error E2337 c:\Progra~1\Borland\Bcc5\include\gl/glut.h 146: Only one of a set of overloaded functions can be "C".
I am sorry if this is a really stupid question but I know nothing about setting up compilers or OpenGL except for what I have learnt today. Please could someone tell me what I am doing wrong so I can get on and practise some proper OpenGl coding.
Phil
I am trying to learn about OpenGL to prepare for my computer graphics course at uni next year. Today I dled the Borland C++ compiler for win98 and followed the instructions to set it up (putting gl.h, glu.h, glut.h in include/gl dir, glu32.lib, opengl32.lib, glut32.lib in lib dir and glu32.dll, opengl32.dll and glut32.dll in windows/system). I made myself a bcc32.cfg file:
-I"c:\Progra~1\Borland\Bcc55\include"
-L"c:\Progra~1\Borland\Bcc55\lib"
-W
and an ilink32.cfg file:
-L"c:\Progra~1\Borland\Bcc55\lib"
and put them in the bin dir.
I also set the PATH variable correctly.
To test that I had set everything up properly I copied a simple program from a book:
#include <windows.h>
#include <gl/gl.h>
#include <gl/glut.h>
//<<<<<<<<<<<<<<<<<<<<<<myInit>>>>>>>>>>>>>>>
void myInit(void)
{
glClearColor(1.0,1.0,1.0,0.0); //set white bg colour
glColor3f(0.0f, 0.0f, 0.0f); //set the drawing color
glPointSize(4.0); //a dot is 4x4 pixels
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
//<<<<<<<<<<<<<<<<<<<<<myDisplay>>>>>>>>>>>>>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT); //clear the screen
glBegin(GL_POINTS);
glVertex2i(100, 50); //draw 3 points
glVertex2i(100, 130);
glVertex2i(150, 130);
glEnd();
glFlush(); //send all output to display
}
//<<<<<<<<<<<<<<<<<<<<<main>>>>>>>>>>>>>>>>>>
void main(int argc, char** argv)
{
glutInit(&argc, argv); //init the toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); //set display mode
glutInitWindowSize(640,480); //set window size
glutInitWindowPosition(100, 150); //set window position
glutCreateWindow("my first attempt"); //open screen window
glutDisplayFunc(myDisplay); //register redraw fn
myInit();
glutMainLoop(); //go into a perpetual loop
}
I saved this as DrawDot.cpp.
When I attempted to compile the program in dos (bcc32 DotDraw.cpp) I got the following error "Error E2337 c:\Progra~1\Borland\Bcc5\include\gl/glut.h 146: Only one of a set of overloaded functions can be "C".
I am sorry if this is a really stupid question but I know nothing about setting up compilers or OpenGL except for what I have learnt today. Please could someone tell me what I am doing wrong so I can get on and practise some proper OpenGl coding.
Phil