How to import opengl programs in VC++?
-
hello to all.. my question : i have some codes of OPENGL. now i want to import it in VC++.
-
hello to all.. my question : i have some codes of OPENGL. now i want to import it in VC++.
Can you be more specific.
WhiteSky
-
Can you be more specific.
WhiteSky
thank u for reply.. actually below codes are opengraphical language(OpenGL).. this program should be called in VC++ .. how i have to call in my program.. help me.. #include #include #include #include #include /* * Window properties */ #define WINDOW_WIDTH 500 #define WINDOW_HEIGHT 500 #define WINDOW_X 100 #define WINDOW_Y 100 #define WINDOW_TITLE "RGB-ColorCube" /* * Perspective properties */ #define FOV_ANGLE 30 #define CENTER_X 0.0 #define CENTER_Y 0.0 #define CENTER_Z 0.0 #define VIEWER_X 0.0 #define VIEWER_Y 0.0 #define VIEWER_Z -2.1 #define UP_X 0.0 #define UP_Y 1.0 #define UP_Z 0.0 #define CLIPPLANE_NEAR 1.0 #define CLIPPLANE_FAR 20.0 #define ROTATION_SPEED 2.0 #ifndef M_PI #define M_PI 3.14159265358979323846 #endif GLfloat rot_x = 0.0, rot_y = 0.0; GLfloat saved_x, saved_y; /* * Material colors used for shading */ GLfloat red[4] = {.8, 0.0, 0.0, 1.0}; GLfloat white[4] = {.8, .8, .8, 1.0}; /* * Function prototypes */ void usage(void); void draw_scene(void); void draw_object(void); void init(int argc, char **argv, void (*draw)(void)); void save_position(int button, int state, int x, int y); struct point get_coords(double a, double b); void vertex(double a, double b); void rotate(int x, int y); void set_color(int angle); int main(int argc, char **argv) { /* * Init OpenGL and enter the event loop */ init(argc, argv, draw_scene); return 0; } /* * Handle rotations and buffer swapping and call the function draw_object * which does the actual drawing */ void draw_scene(void) { static GLfloat old_rot_matrix[16]; static int initialized = 0; GLfloat new_rot_matrix[16]; /* calculate new rotation matrix */ glPushMatrix(); glLoadIdentity(); glRotatef(rot_x, 1.0, 0.0, 0.0); glRotatef(rot_y, 0.0, 1.0, 0.0); glGetFloatv(GL_MODELVIEW_MATRIX, new_rot_matrix); glPopMatrix(); /* calculate total rotation */ glPushMatrix(); glLoadIdentity(); glMultMatrixf(new_rot_matrix); if (initialized) { glMultMatrixf(old_rot_matrix); } glGetFloatv(GL_MODELVIEW_MATRIX, old_rot_matrix); initialized = 1; glPopMatrix(); glPushMatrix(); glMultMatrixf(old_rot_matrix); draw_object(); glPopMatrix(); glFlush();
-
thank u for reply.. actually below codes are opengraphical language(OpenGL).. this program should be called in VC++ .. how i have to call in my program.. help me.. #include #include #include #include #include /* * Window properties */ #define WINDOW_WIDTH 500 #define WINDOW_HEIGHT 500 #define WINDOW_X 100 #define WINDOW_Y 100 #define WINDOW_TITLE "RGB-ColorCube" /* * Perspective properties */ #define FOV_ANGLE 30 #define CENTER_X 0.0 #define CENTER_Y 0.0 #define CENTER_Z 0.0 #define VIEWER_X 0.0 #define VIEWER_Y 0.0 #define VIEWER_Z -2.1 #define UP_X 0.0 #define UP_Y 1.0 #define UP_Z 0.0 #define CLIPPLANE_NEAR 1.0 #define CLIPPLANE_FAR 20.0 #define ROTATION_SPEED 2.0 #ifndef M_PI #define M_PI 3.14159265358979323846 #endif GLfloat rot_x = 0.0, rot_y = 0.0; GLfloat saved_x, saved_y; /* * Material colors used for shading */ GLfloat red[4] = {.8, 0.0, 0.0, 1.0}; GLfloat white[4] = {.8, .8, .8, 1.0}; /* * Function prototypes */ void usage(void); void draw_scene(void); void draw_object(void); void init(int argc, char **argv, void (*draw)(void)); void save_position(int button, int state, int x, int y); struct point get_coords(double a, double b); void vertex(double a, double b); void rotate(int x, int y); void set_color(int angle); int main(int argc, char **argv) { /* * Init OpenGL and enter the event loop */ init(argc, argv, draw_scene); return 0; } /* * Handle rotations and buffer swapping and call the function draw_object * which does the actual drawing */ void draw_scene(void) { static GLfloat old_rot_matrix[16]; static int initialized = 0; GLfloat new_rot_matrix[16]; /* calculate new rotation matrix */ glPushMatrix(); glLoadIdentity(); glRotatef(rot_x, 1.0, 0.0, 0.0); glRotatef(rot_y, 0.0, 1.0, 0.0); glGetFloatv(GL_MODELVIEW_MATRIX, new_rot_matrix); glPopMatrix(); /* calculate total rotation */ glPushMatrix(); glLoadIdentity(); glMultMatrixf(new_rot_matrix); if (initialized) { glMultMatrixf(old_rot_matrix); } glGetFloatv(GL_MODELVIEW_MATRIX, old_rot_matrix); initialized = 1; glPopMatrix(); glPushMatrix(); glMultMatrixf(old_rot_matrix); draw_object(); glPopMatrix(); glFlush();
I guess you got errors when compile this code,right? it was better you used of pre tags for your code.;)
WhiteSky