OpenGL-programmering|Programmering / Grafisk formgivning|Forum|Nordichardware

Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
The forums are currently locked and only available for read only access
sp_Feed sp_TopicIcon
OpenGL-programmering
Avatar
fackamato
Member
Medlem
Forum Posts: 5913
Member Since:
March 5, 2002
sp_UserOfflineSmall Offline
1
October 31, 2003 - 3:15 am
sp_Permalink sp_Print

Visual C++, jag har GLUT-grejerna 😉
OBS detta är taget ifrån en annan sida, jag bara experimenterar 🙂

#include <windows.h>
#include <glut.h>
#include <stdio.h>
#include <stdlib.h>

void init ( void )
{
glEnable ( GL_DEPTH_TEST );
glClearColor ( 0.0, 0.0, 0.0, 0.0 );
}

void display ( void ) // Used to draw stuff to the screen
{

glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

// Draw a single point
glColor4f(1.0, 1.0, 0.0, 1.0);
glPushMatrix ( );
glBegin(GL_POINTS);
glPointSize(5.0);
glVertex3f(0.f,0.f,0.f);
glEnd();
glPopMatrix ( );


glutSwapBuffers ( );
}

void reshape (int w, int h)
{

// w inneholder bredden på skjermen 1280
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-1.5*(GLfloat)w/(GLfloat)h, 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

void keyboard ( unsigned char key, int x, int y ) // This is the keyboard input method
{
switch ( key ) {
case 27:
exit ( 0 );
break;
case 'f':
glutFullScreen ();
break;
case 'w':
glutReshapeWindow ( 500,500 );
break;
default:
break;
}
}

void myMouse(int button, int state, int x, int y) {
switch (button) {
case 0:
switch(state) {
case 0: // MouseDown (Left)
break;
case 1: // MouseDown (Right)
break;
}
break;
case 2:
switch(state) {
case 0: // MouseDown (Right)
break;
case 1: // MouseUp (Right)
break;
}
break;
}
}

void IdleFunc() {
display();
}

/* Main */
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE ); // Initialize double buffered display
glutInitWindowSize ( 500, 500 ); // Set the window size to 250x250 pixels
glutCreateWindow ( argv[0] ); // Open the window
init(); // Initialize stuff
glutReshapeFunc ( reshape ); // Method used to create the perspective view (makes stuff look 3Dish)
glutKeyboardFunc ( keyboard ); // Method to handle keyboard input
glutMouseFunc ( myMouse ); // Method to handle mouse input
glutDisplayFunc ( display ); // Method that displays stuff on the screen
glutIdleFunc ( IdleFunc ); // Idle Function
glutMainLoop ( ); // Keep program running in a loop until exit
return 0; // return
}

Detta fungerar inte att kompilera, av någon anledning.

Linking...
C:ProgramMicrosoft Visual StudioVC98LIBglut32.lib : warning LNK4003: invalid library format; library ignored
C:ProgramMicrosoft Visual StudioVC98LIBglut32.lib : warning LNK4003: invalid library format; library ignored
simple_app.obj : error LNK2001: unresolved external symbol _glutSwapBuffers@0
simple_app.obj : error LNK2001: unresolved external symbol _glutReshapeWindow@8
simple_app.obj : error LNK2001: unresolved external symbol _glutFullScreen@0
simple_app.obj : error LNK2001: unresolved external symbol _glutMainLoop@0
simple_app.obj : error LNK2001: unresolved external symbol _glutIdleFunc@4
simple_app.obj : error LNK2001: unresolved external symbol _glutDisplayFunc@4
simple_app.obj : error LNK2001: unresolved external symbol _glutMouseFunc@4
simple_app.obj : error LNK2001: unresolved external symbol _glutKeyboardFunc@4
simple_app.obj : error LNK2001: unresolved external symbol _glutReshapeFunc@4
simple_app.obj : error LNK2001: unresolved external symbol _glutCreateWindow@4
simple_app.obj : error LNK2001: unresolved external symbol _glutInitWindowSize@8
simple_app.obj : error LNK2001: unresolved external symbol _glutInitDisplayMode@4
simple_app.obj : error LNK2001: unresolved external symbol _glutInit@8
Debug/simple_app.exe : fatal error LNK1120: 13 unresolved externals
Error executing link.exe.

simple_app.exe - 14 error(s), 2 warning(s)

Zym
Kommer du hit ofta?
Medlem
Forum Posts: 274
Member Since:
August 18, 2003
sp_UserOfflineSmall Offline
447237
October 31, 2003 - 5:29 am
sp_Permalink sp_Print

är väl bara o läsa felrapporten det, det står att glut32.lib inte är giltig, o det är väl antagligen där som alla andra objekt är deklarerade...

eller vad tror du?

Avatar
fackamato
Member
Medlem
Forum Posts: 5913
Member Since:
March 5, 2002
sp_UserOfflineSmall Offline
447493
October 31, 2003 - 2:01 pm
sp_Permalink sp_Print

Hehe du hade rätt. Det är farligt att vara uppe så sent 🙂

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1030
Currently Online:
Guest(s) 348
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Andreas Galistel: 16287
Jonas Klar: 15897
ilg@dd: 10810
Nyhet: 10607
Mind: 10550
Ctrl: 10355
Gueno: 9881
Guest: 9344
Snorch: 8881
Callister: 8468
Newest Members:
PetrbonFU PetrbonFU
Karine Bembry
Dolores Mcdaniels
Anibal McLeish
Francisca Alt
Alfie Everhart
Lester Huitt
Orlando Jorgensen
Mikki Lundgren
Dakota Kozlowski
Forum Stats:
Groups: 11
Forums: 59
Topics: 146630
Posts: 1300967

 

Member Stats:
Guest Posters: 2
Members: 79425
Moderators: 0
Admins: 11
Administrators: nordicadmin, Henrik Berntsson, Anton Karmehed, Carl Holmberg, Joel Oscarsson, Mikael Linnér, Mikael Schwartz, Andreas Paulsson, Nickebjrk, Mattias Pettersson, EmxL