Results 1 to 5 of 5

Thread: glGet (again)

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

    glGet (again)

    I'm looking to write a class that uses openGL to do matrix operations, because I assume theirs will be much faster than my own. This class won't be doing anything graphical, just calling MultMatrix, Translate... when I asked before, why the glGet methods weren't modifying the values I passed them, the response was that I needed to give GL a rendering context beforehand. I have/had no idea what that means. I looked it up and found some wgl and glx stuff, but I don't want this to be platform specific, so what's the minimal that I need to do to get glGet to glGive? Here's the non-functional test I wrote:

    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;
    }

  2. #2
    Guest

    Re: glGet (again)

    Please don't duplicate posts.

    As I said, use GLUT for this. GLUT provides a cross-platform solution.

    Have a nice day.

  3. #3
    Guest

    Re: glGet (again)

    You need to create a render context and make it current on your machine, there's no other way to access OpenGL-commands. So at least the initialisation stuff has to be platform-dependent.

    Good luck, moebius

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

    Re: glGet (again)

    To: <Nad> unregistered

    I apologize for the duplication. I had this page loaded, and foolishly went to post a new topic before refreshing/checking for your latest response. Thanks for your patience.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: glGet (again)

    I highly doubt, that what you are doing will increase speed in any way. In fact, i am quite sure, that you will see horrible speed, even compared to "normally" calculating matrices.

    What you are trying to do means, that you first send the command to the driver, which will cache it and only process it if you actually issue a draw-call, and then you will retrieve the data from the driver (which means it could be read from the GPU).

    Let me tell you, that sounds bad! The GPU might be fast at computing that stuff, but the overhead of sending and retrieving the data is so damned high, that you will be baffled about the low speed.

    And you are doing all this for 4x4 matrices??

    Do it the normal way (calculating all on the CPU), that will save you a lot of time and will be much faster. If you really want to improve speed, take a look at SSE.

    Maybe you should first learn how to use the GPU (through OpenGL) for what it is actually designed for (rendering), before you try to (mis-)use it for something different.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

Similar Threads

  1. glGet Alternative?
    By Rhawk187 in forum OpenGL: Advanced Coding
    Replies: 17
    Last Post: 05-21-2008, 03:22 PM
  2. glGet
    By felix82 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-21-2006, 05:13 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