Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to import opengl programs in VC++?

How to import opengl programs in VC++?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphicsgame-devtutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikramkarthik
    wrote on last edited by
    #1

    hello to all.. my question : i have some codes of OPENGL. now i want to import it in VC++.

    H 1 Reply Last reply
    0
    • V vikramkarthik

      hello to all.. my question : i have some codes of OPENGL. now i want to import it in VC++.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Can you be more specific.


      WhiteSky


      V 1 Reply Last reply
      0
      • H Hamid Taebi

        Can you be more specific.


        WhiteSky


        V Offline
        V Offline
        vikramkarthik
        wrote on last edited by
        #3

        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();

        H 1 Reply Last reply
        0
        • V vikramkarthik

          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();

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          I guess you got errors when compile this code,right? it was better you used of pre tags for your code.;)


          WhiteSky


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups