I've an error when try this code. i've installed DeVC++ 4.9.9.2 with Glut
installed. how to solve it?
here's the code..
include <GL glut.h="">
const int A = 500; / length of a side of the monitor window /
const float B = 500; / length of a side of the clipping rectangle /
const float C = 200; / length of a side of the square the program draws /
glMatrixMode(GL_PROJECTION); / In World coordinates: /
glLoadIdentity(); / position the "clipping rectangle" /
gluOrtho2D( -B/2, B/2, -B/2, B/2);/ at -B/2, its right edge at +B/2, its
bottom /
glMatrixMode(GL_MODELVIEW); / edge at -B/2 and its top edge at +B/2 /
}
void display( void )
{
glClear(GL_COLOR_BUFFER_BIT); / clear the window /
glMatrixMode(GL_MODELVIEW); / The following coordinates are expressed /
glLoadIdentity(); / in terms of World coordinates /
It is compiling from a makefile instead of a project.
Have you created a dev-cpp project that contains main.cpp?
The project must also contain paths to the glut header and library files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2011-09-28
I've created an dev-cpp project that contains main.cpp files and was already
including path for glut header and library.
include <windows.h>
include <gl gl.h="">
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You must create a project FILE that contains information about how to compile
the project.
Look thru the menus to determine how to do it.
The glut path must be included in the project file, not in the source code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've an error when try this code. i've installed DeVC++ 4.9.9.2 with Glut
installed. how to solve it?
here's the code..
include <GL glut.h="">
const int A = 500; / length of a side of the monitor window /
const float B = 500; / length of a side of the clipping rectangle /
const float C = 200; / length of a side of the square the program draws /
void myinit(void)
{
glClearColor(0.7, 0.7, 0.7, 0.0); / gray background /
glMatrixMode(GL_PROJECTION); / In World coordinates: /
glLoadIdentity(); / position the "clipping rectangle" /
gluOrtho2D( -B/2, B/2, -B/2, B/2);/ at -B/2, its right edge at +B/2, its
bottom /
glMatrixMode(GL_MODELVIEW); / edge at -B/2 and its top edge at +B/2 /
}
void display( void )
{
glClear(GL_COLOR_BUFFER_BIT); / clear the window /
glMatrixMode(GL_MODELVIEW); / The following coordinates are expressed /
glLoadIdentity(); / in terms of World coordinates /
glBegin(GL_POLYGON) ; / draw a filled polygon /
glColor3f ( 1.0, 0.3, 0.2); / draw in light red /
glVertex2f( -C/2, -C/2 ); / (x,y) /
glVertex2f( C/2, -C/2 ); / (x,y) /
glVertex2f( C/2, C/2 ); / (x,y) /
glVertex2f( -C/2, C/2 ); / (x,y) /
glEnd();
glFlush(); / send all commands /
}
void main(int argc, char argv)
{
glutInit(&argc,argv);
glutInitWindowSize( A, A ); / A x A pixel screen window /
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE);
glutCreateWindow("My Rectangle"); / window title /
glutDisplayFunc(display); / tell OpenGL main loop what /
myinit(); / set attributes /
glutMainLoop(); / pass control to the main loop /
You need to post your compile log.
I am assuming the missing brace at the end is an error in copying.
here's compiler log's
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
-I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-
Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-
Cpp/include"
g++.exe: main.cpp: No such file or directory
g++.exe: no input files
make.exe: *** Error 1
It is compiling from a makefile instead of a project.
Have you created a dev-cpp project that contains main.cpp?
The project must also contain paths to the glut header and library files.
I've created an dev-cpp project that contains main.cpp files and was already
including path for glut header and library.
include <windows.h>
include <gl gl.h="">
You must create a project FILE that contains information about how to compile
the project.
Look thru the menus to determine how to do it.
The glut path must be included in the project file, not in the source code.