Results 1 to 4 of 4

Thread: glGet

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2005
    Posts
    4

    glGet

    I cannot for the life of me figure out why glGet is not working for me. To illustrate, I just wrote a quick and dirty tester program:

    Code :
    #include<stdio.h>
    #include"GL/glu.h"
    #include"GL/gl.h"
    #include"stdlib.h"
     
    int main()
    {
        float* mat = (float*)malloc((16*sizeof(float)));
     
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glGetFloatv(GL_MODELVIEW_MATRIX, mat);
     
        int i,j;
        i = j = 0;
     
        for(;i < 16;)
        {
            printf("[ ");
            for(j = 0; j < 4; j++)
            {
                printf("%f ", mat[i]);
                i++;
            }
            printf(" ]\n");
        }
     
        int mode = 0;
     
        glGetIntegerv(GL_MATRIX_MODE, &amp;mode);
        printf("%d \n", mode);
        return 0;
    }
    mat remains unchanged, and I get all zeros in the print out.

  2. #2
    Guest

    Re: glGet

    You need to have a OpenGL render context current before you can call into the API.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2005
    Posts
    4

    Re: glGet

    Yeah...I'm so much of a beginner that I don't know what you're talking about. I (obviously) assumed including gl.h would be context enough. What, other initialization would I require?

  4. #4
    Guest

    Re: glGet

    Check out GLUT:
    http://www.xmission.com/~nate/glut.html

    It's a nice little wrapper that handles window and context creation for you, among other things like input event notifications. Very easy to install and use. Be sure to read the ReadMe file for instructions on where to put everything. There are countless demos that utilize GLUT, so there is no shortage of examples.

    Have a peek at the sticky Wiki, all this is in there, and more.

Similar Threads

  1. glGet Alternative?
    By Rhawk187 in forum OpenGL: Advanced Coding
    Replies: 17
    Last Post: 05-21-2008, 03:22 PM
  2. glGet (again)
    By felix82 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-21-2006, 08:10 PM
  3. glGet with GL_MODELVIEW_MATRIX won't work
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-30-2002, 03:51 AM
  4. strange GL Error (VPs and glGet)
    By Diapolo in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 09-27-2002, 09:37 AM
  5. glGet()
    By SED in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-27-2000, 07:21 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