Results 1 to 7 of 7

Thread: OpenGL/Mesa?

  1. #1

    OpenGL/Mesa?

    Hi, im having trouble setting up an OpenGL environment using GLUT API 3, except most of the packages require Visual Studio! Does anyone know how to set up GLUT or MESA for any system or editor to create an environment for all openGL programs?


    Heres a code sample to test on (please excuse the long post):

    #include <GL/glut.h>
    #include "stdlib.h"

    #define RAMPSIZE 16
    #define RAMP1START 32
    #define RAMP2START 48

    static float rotAngle = 0.;

    /* Initialize antialiasing for color index mode,
    * including loading a green color ramp starting
    * at RAMP1START, and a blue color ramp starting
    * at RAMP2START. The ramps must be a multiple of 16.
    */
    void init(void)
    {
    int i;

    for (i = 0; i < RAMPSIZE; i++) {
    GLfloat shade;
    shade = (GLfloat) i/(GLfloat) RAMPSIZE;
    glutSetColor(RAMP1START+(GLint)i, 0., shade, 0.);
    glutSetColor(RAMP2START+(GLint)i, 0., 0., shade);
    }

    glEnable (GL_LINE_SMOOTH);
    glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
    glLineWidth (1.5);

    glClearIndex ((GLfloat) RAMP1START);
    }

    /* Draw 2 diagonal lines to form an X
    */
    void display(void)
    {
    glClear(GL_COLOR_BUFFER_BIT);

    glIndexi(RAMP1START);
    glPushMatrix();
    glRotatef(-rotAngle, 0.0, 0.0, 0.1);
    glBegin (GL_LINES);
    glVertex2f (-0.5, 0.5);
    glVertex2f (0.5, -0.5);
    glEnd ();
    glPopMatrix();

    glIndexi(RAMP2START);
    glPushMatrix();
    glRotatef(rotAngle, 0.0, 0.0, 0.1);
    glBegin (GL_LINES);
    glVertex2f (0.5, 0.5);
    glVertex2f (-0.5, -0.5);
    glEnd ();
    glPopMatrix();

    glFlush();
    }

    void reshape(int w, int h)
    {
    glViewport(0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    if (w <= h)
    gluOrtho2D (-1.0, 1.0,
    -1.0*(GLfloat)h/(GLfloat)w, 1.0*(GLfloat)h/(GLfloat)w);
    else
    gluOrtho2D (-1.0*(GLfloat)w/(GLfloat)h,
    1.0*(GLfloat)w/(GLfloat)h, -1.0, 1.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }

    void keyboard(unsigned char key, int x, int y)
    {
    switch (key) {
    case 'r':
    case 'R':
    rotAngle += 20.;
    if (rotAngle >= 360.) rotAngle = 0.;
    glutPostRedisplay();
    break;
    case 27: /* Escape Key */
    exit(0);
    break;
    default:
    break;
    }
    }

    /* Main Loop
    * Open window with initial window size, title bar,
    * color index display mode, and handle input events.
    */
    int main(int argc, char** argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX);
    glutInitWindowSize (200, 200);
    glutCreateWindow (argv[0]);
    init();
    glutReshapeFunc (reshape);
    glutKeyboardFunc (keyboard);
    glutDisplayFunc (display);
    glutMainLoop();
    return 0;
    }

  2. #2

    Re:OpenGL/Mesa?

    Were you already here:
    http://www.mesa3d.org/
    ?

  3. #3

    Re:OpenGL/Mesa?

    Yes, and the files downloaded were quite confusing to work with. Ive been switching between different platforms and editors trying to work it out but its very confusing!


  4. #4

    Re:OpenGL/Mesa?

    What distribution are you running?

    If the files require visual studio then they would be win32 packages, and hence not linux packages.

  5. #5

    Re:OpenGL/Mesa?

    I am running SuSE 9.0 personal, however there are solaris and unix packages for GLUT, and MESA is supposed to be the linux translation

  6. #6

    Re:OpenGL/Mesa?

    MESA is an implementation of the OpenGL API, so this is probably what you want. Also, judging from your original post, you're trying to compile applications using GL.

    Some linux distributions (SuSE included, I believe), separate binary packages and source code. When you compile the source from MESA, you get binaries that other applications can link against and call GL APIs. When you install MESA, that's usually what you get...a binary. If you want the actual development headers so that you can include source code, you'll have to get the dev package (could also be devel package).

    Here's where I wish I had better experience with SuSE. I have absolutely no idea how SuSE installs new packages. I think it's with YaST. Either way, is there a way for you to look at a list of all available packages offered by SuSE? In this day and age there has to be...poke around the control panel and see if you can find a big list of installed software vs available software. Once you have this list, look around for any packages involving mesa, and specifically look around for something called "mesa-dev" or "mesa-devel" or "libmesa-devel" or something along those lines. The dev part says "these are the source headers for this library, install these if you want to compile anything using this lib."

    If anyone who has more experience with SuSE can be of more help, please jump in at any time.

  7. #7

    Re:OpenGL/Mesa?

    Would an ldconfig work?

Similar Threads

  1. Magic++ in conjunction with OpenGL
    By maccorin in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 09-28-2004, 08:56 AM
  2. Advanced OpenGL Effects?
    By beezlebubsbum in forum Linux - General Topics
    Replies: 4
    Last Post: 08-19-2004, 10:11 PM
  3. OpenGL problem!
    By beezlebubsbum in forum Linux - General Topics
    Replies: 8
    Last Post: 06-04-2004, 10:22 PM
  4. Lovechild, a Mesa 4.0.2 question
    By ASCI_Blue in forum General Chat
    Replies: 2
    Last Post: 05-15-2002, 03:30 PM
  5. OpenGL beginners help ..
    By civ1492 in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 03-07-2002, 09:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •