Professional Web Applications Themes

(OpenGL) Crashing in glGetIntegerv? - Mac Programming

Hello, I am having a strange crash in the OpenGL function glGetIntegerv. AFAIK the following program should work, but I get "Bus error" inside the first call to glGetIntegerv. (I am a complete OpenGL newbie, just trying to port some software). #include <stdio.h> #include <OpenGL/gl.h> int main() { GLint max_mv_depth; GLint max_tex; glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_tex); printf("Max texture is %d\n", (int)max_tex); glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &max_mv_depth); printf("Max mv stack depth is %d\n", (int)max_mv_depth); } I built it with "-framework OpenGL" I am using 10.2.8 on an iBook G3 (ATI Rage 128 Pro). Other applications using OpenGL work fine. Thanks for any help or suggestions! ...

  1. #1

    Default (OpenGL) Crashing in glGetIntegerv?

    Hello, I am having a strange crash in the OpenGL function
    glGetIntegerv. AFAIK the following program should work, but I get "Bus
    error" inside the first call to glGetIntegerv. (I am a complete
    OpenGL newbie, just trying to port some software).


    #include <stdio.h>
    #include <OpenGL/gl.h>

    int main() {
    GLint max_mv_depth;
    GLint max_tex;
    glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_tex);
    printf("Max texture is %d\n", (int)max_tex);
    glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &max_mv_depth);
    printf("Max mv stack depth is %d\n", (int)max_mv_depth);
    }


    I built it with "-framework OpenGL"

    I am using 10.2.8 on an iBook G3 (ATI Rage 128 Pro).
    Other applications using OpenGL work fine.

    Thanks for any help or suggestions!

    reed
    Reed Guest

  2. #2

    Default Re: (OpenGL) Crashing in glGetIntegerv?

    In article <google.com>,
    net (Reed Hedges) wrote:
     

    You don't have a valid OGL context. You need to create one using the
    platform-specific API (in your case AGL) before you can make any GL calls.

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  3. #3

    Default Re: (OpenGL) Crashing in glGetIntegerv?

    In article <google.com>,
    net (Reed Hedges) wrote:
     

    Do you have a working openGL view when those calls are made? It seems
    as if you do not. I suggest going to http://nehe.gamedev.net/ and
    downloading some of the early tutorials (column to the left of the
    main text). The tutorials are written for Windows, but if you scroll
    to the bottom of a given tutorial, you'll find links to various ports
    of the code - including for OS X/Cocoa. NeHe is a very good place for
    learning openGL.

    --
    C Lund, www.notam02.no/~clund
    C Guest

  4. #4

    Default Re: (OpenGL) Crashing in glGetIntegerv?

    Thanks C. Lund and Miro, I had no GL context. In the software I was
    working with, glGetIntegerv was being called from the constructor of a
    static C++ class instance.

    I guess it works on Linux, but not Mac.
    Reed Guest

Similar Threads

  1. OpenGL module
    By dpm in forum PERL Modules
    Replies: 0
    Last Post: September 23rd, 11:18 PM
  2. No OpenGL?
    By Emeric Maschino in forum AIX
    Replies: 3
    Last Post: August 12th, 07:52 PM
  3. OpenGL
    By Walter Clayton in forum Windows XP/2000/ME
    Replies: 1
    Last Post: July 22nd, 02:23 AM
  4. OpenGL on Mac OS X
    By James Adam in forum Ruby
    Replies: 0
    Last Post: June 30th, 03:14 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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139