Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. gcc main.c -lGL -lGLU -lglut

gcc main.c -lGL -lGLU -lglut

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 916 Views
  • 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.
  • neemeN Offline
    neemeN Offline
    neeme
    wrote on last edited by
    #1

    hi:
    I have a file (main.c) .
    I use gcc main.c -lGL -lGLU -lglut (is ok).
    How can i build in qtcreate 4.2.0(qt 5.7.1) ? Thank you!

    #include <GL/glut.h>

    void myinit();
    void display();

    int main(int argc, char **argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(500,500);
    glutInitWindowPosition(0,0);
    glutCreateWindow("simple OpenGL example");
    glutDisplayFunc(display);
    myinit();
    glutMainLoop();
    }

    void myinit()
    {
    glClearColor(0.0,0.0,0.0,1.0);
    glColor3f(0.0,1.0,0.0);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0.0, 50.0, 0.0, 50.0);
    glMatrixMode(GL_MODELVIEW);
    

    }

    void display()
    {
    GLfloat vertices[3][2] = {{0.0,0.0},{25.0,50.0},{50.0,0.0}};
    int j,k;
    int rand();
    GLfloat p[2] = {7.5, 5.0};
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POINTS);
    for(k=0;k<900000;k++)
    {
    j=rand()%3;
    p[0] = (p[0]+vertices[j][0]) / 2.0;
    p[1] = (p[1]+vertices[j][1]) / 2.0;
    glVertex2fv(p);
    }

    glEnd();
    glFlush();
    

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean having a .pro file with:

      SOURCES += main.c
      LIBS += -lGL -lGLU -lglut
      

      in it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved