Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: glut my but (don't work) (few other questions also)

  1. #1

    glut my but (don't work) (few other questions also)

    I am useing Dev-C++... and i have glut.h... but when i run this code it say that all my functions are undefined.
    Code :
    #include <GL/glut.h>
    #include <stdlib.h>
     
    void display(void)
    {
    glClear(GL_COLOR_BUFFER_BIT);
     
    glColor3f(1.0, 1.0, 1.0);
    glBegin(GL_POLYGON);
          glVertex3f(0.25, 0.25, 0.0);
          glVertex3f(0.75, 0.25, 0.0);
          glVertex3f(0.75, 0.75, 0.0);
          glVertex3f(0.25, 0.75, 0.0); 
    glEnd();
    glFlush();
    }
     
    void init(void)
    {
    glClearColor(0.0, 0.0, 0.0, 0.0);
     
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
    }
     
    int main(int argc, char** argv)
    {
    glutInit(&amp;argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_ RGB);  
    glutInitWindowSize(250, 250);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("hello");
    init();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
    }
    please help
    Programming makes my head burn.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Fort Collins, Colorado
    Posts
    446

    Re: glut my but (don't work) (few other questions also)

    I'm guessing you haven't linked glut32.lib

  3. #3

    Re: glut my but (don't work) (few other questions also)

    i tried that and it still doesnt work.
    Programming makes my head burn.

  4. #4
    Member Contributor
    Join Date
    Oct 2001
    Posts
    67

    Re: glut my but (don't work) (few other questions also)

    Which functions does it say are undefined -- the gl ones or the glut ones? Does it complain at link time or at compile time?

    I can see two possible problems -- it either can't find glut.h, or you may have forgotten to link against opengl32.lib.

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2002
    Location
    Mooroolbark, VIC, Australia
    Posts
    4

    Re: glut my but (don't work) (few other questions also)

    I don't use Glut so I could be wrong..

    Does GLUT Include gl.h? If not, then I'd say thats your problem..

    Try including <gl/gl.h> and <gl/glu.h>

    and linking to opengl32.lib and glu32.lib

    Hope this helps

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: glut my but (don't work) (few other questions also)

    Doesn't Dev-C++ use .a files instead of .lib files?

    In any case, I think to add the libraries, somewhere you need to add -lGL -lglut -lGLU to the command-line parameters that Dev-C++ uses. I haven't used Dev-C++ much myself, so I can't tell you exactly where that goes, offhand.
    Deiussum
    Software Engineer and OpenGL enthusiast

  7. #7
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: glut my but (don't work) (few other questions also)

    Hi !

    The latest versions of MinGW32 can use .lib files without problems, but older ones need .a files

    Mikael

  8. #8

    Re: glut my but (don't work) (few other questions also)

    ok... should i use glut or should i do it with windows API?

    And what format of 3d objects does opengl mainly use? .obj? If so... is there an .obj texture program around... thanks
    Programming makes my head burn.

  9. #9

    Re: glut my but (don't work) (few other questions also)

    And the compiling... it just says that names all the functions and says they are undefined.... i have tried everything
    Programming makes my head burn.

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: glut my but (don't work) (few other questions also)

    OpenGL has no support for any given file format. You have to do that on your own or use a 3rd party library.

    The errors you are getting are likely linker errors, which means that you haven't included the library to be linked into the project. Since you haven't copy/pasted the exact error, this is just an educated guess, though.

    As I said above, to link a library in you need to find out where to do that in the Dev-C++ project settings. Contrary to the belief of many new programmers, #include does not add a library, but just supplies a header file. (In the case of VC++ and Borland, however, there are #pragma statements that can be used to link in a library, however. Not sure of any equivalent for Dev-C++ off hand, though.)
    Deiussum
    Software Engineer and OpenGL enthusiast

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 4
    Last Post: 05-01-2012, 09:04 PM
  2. mac glut questions
    By nib in forum OpenGL: macOS
    Replies: 11
    Last Post: 05-08-2007, 11:34 AM
  3. two questions about glut/glaux..
    By pipiloo in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-08-2002, 12:50 AM
  4. GLUT questions
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-30-2001, 07:12 PM
  5. What do I do to get the GLUT to work?
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-30-2001, 11:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean