donwload this file http://chortle.ccsu.edu/Bloodshed/glutming.zip and extract (exemple c:\)
2. visit this side and download http://tdm-gcc.tdragon.net/download
TDM-GCC-32 for windows
---------------------------------------------------------------------------------------------
n c
-----------------------------------------------------------------------------------------------
c:\ GLUTMingw32\ |C:\TDM-GCC-32\include
| include\ | |GL\
|GL\ | | fgl
| fgl | | etc..
| fglu |
| fglut |
| glsmap copy this file intro folder GL
| glut |
| glutf90 |
| tube |
| lib\ |C:\TDM-GCC-32\lib
| libgle.a |
| libglsmap.a |
| libglut32.a copy this file intro folder lib
| libmui.a |
| readme.txt || glut32.dll copy glut32.dll intro folder C:\Windows\System32
------------------------------------------------------------------------------------------------------
now time to test (you can use word or notepad) create test.cpp in C:\TDM-GCC-32\ now open this file and pase this code:
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include<string.h>
void OutText (char* s)
{
glPushMatrix();
glScalef(0.001f, 0.001f,0);
if (s && strlen(s)) {
while (*s) {
glutStrokeCharacter(GLUT_STROKE_ROMAN, *s);
s++;
}
}
glPopMatrix();
}
void Display()
{
glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear( GL_COLOR_BUFFER_BIT );
glColor3f( 1.0, 0.0, 0.0 );
OutText ("hello glut!");
glFlush();
glutSwapBuffers();
}
void Reshape( int width, int height )
{
Display();
}
int main( int argc, char * argv[] )
{
glutInit( & argc, argv );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB );
glutInitWindowSize( 400, 400 );
glutCreateWindow( "hello from glut" );
glutDisplayFunc( Display );
glutReshapeFunc( Reshape );
glutMainLoop();
return 0;
}
save as test.cpp (not test.cpp.txt)
now its time to compile and run open statr->all program->TDM-GCC-32->MinGW Command Prompt
and write this in command line:
ps.
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include<string.h>
void OutText (char* s)
{
glPushMatrix();
glScalef(0.001f, 0.001f,0);
if (s && strlen(s)) {
while (*s) {
glutStrokeCharacter(GLUT_STROKE_ROMAN, *s);
s++;
}
}
glPopMatrix();
}
void Display()
{
glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear( GL_COLOR_BUFFER_BIT );
glColor3f( 1.0, 0.0, 0.0 );
OutText ("hello glut!");
glFlush();
glutSwapBuffers();
}
void Reshape( int width, int height )
{
Display();
}
int main( int argc, char * argv[] )
{
glutInit( & argc, argv );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB );
glutInitWindowSize( 400, 400 );
glutCreateWindow( "hello from glut" );
glutDisplayFunc( Display );
glutReshapeFunc( Reshape );
glutMainLoop();
return 0;
}
save as test.cpp (not test.cpp.txt)
now its time to compile and run open statr->all program->TDM-GCC-32->MinGW Command Prompt
and write this in command line:
g++ -o test.exe test.cpp -lopengl32 -lglut32
(you have sam warning becouse code is litle bad. ) now write in comand line:
test
that it is yo compile glut in window 7ps.
C:\TDM-GCC-32>g++ -o test.exe test.cpp -lopengl32 -lglut32
test.cpp: In function 'void Display()':
test.cpp:23:25: warning: deprecated conversion from string constant to 'char*' [
-Wwrite-strings]
OutText ("hello glut!");
C:\TDM-GCC-32>test
pps.test.cpp: In function 'void Display()':
test.cpp:23:25: warning: deprecated conversion from string constant to 'char*' [
-Wwrite-strings]
OutText ("hello glut!");
C:\TDM-GCC-32>test
No comments:
Post a Comment