Results 1 to 6 of 6

Thread: Will this cause an GL_INVALID_OPERATION??

  1. #1
    Member Contributor
    Join Date
    Aug 2000
    Location
    Webster, Ma 01570
    Posts
    64

    Will this cause an GL_INVALID_OPERATION??

    Hi Gang,
    I am trying to debug some code that seems like it's giving me some problems. I am getting an GL_INVALID_OPERATION error when I stress out the system, and I can see it is happening around this block of code:

    glBegin(GL_LINE_STRIP);

    for (azListIter = arcVector_[index].listA_begin();, azListIter != arcVector_[index].listA_.end(); ++azListIter)
    {
    // create the XYZ point from the Az, El,
    // and range from the azListIter
    GlobeXYZ pt;
    createArcPoint(azListIter->az_,
    azListIter->el_,
    arcVector_[index].range_,
    pt);
    double vec[3];
    pt.xyzVector(vec);
    glVertex3dv(vec);
    }

    glEnd();

    Now, I have heard that nothing should go between a glBegin and a glEnd except for glVertex, glColor, glIndex, glNormal, glTexCoord, etc commands. Is this really true? Can I call regular C++ functions in between a glBegin and glEnd?

    Thanks for your help. I am a novice at this stuff.

    Roach

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Will this cause an GL_INVALID_OPERATION??

    Yes, you can (and usually do) use any non-OpenGL code you want between a glBegin/glEnd. The only thing you can't use are certain gl commands.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3
    Member Contributor
    Join Date
    Aug 2000
    Location
    Webster, Ma 01570
    Posts
    64

    Re: Will this cause an GL_INVALID_OPERATION??

    Ok, Thanks!

    I am still getting an GL_INVALID_OPERATION error at times though. What else (besides having an invalid call between a glBegin and a glEnd) cause an Invalid Operation error

    Like I said, I only get an Invalid Operation error when I am stressing the system (causing mutiple re-draws in a short period of time). Could this be causing the invalid operation (I.e could I be making calls to draw before the last redraw is done and could this be causing problems?)

    Thanks
    Roach

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Will this cause an GL_INVALID_OPERATION??

    1. Are you using multi-threading?

    2. Are you sure this is the bit of code causing the GL_INVALID_OPERATION? Do you get GL_NO_ERROR before this code executes, and GL_INVALID_OPERATION afterwards?

    3. Is there any chance that the code gets called at any time before the gl context is setup?
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Senior Member Regular Contributor
    Join Date
    Dec 2002
    Location
    Earth
    Posts
    154

    Re: Will this cause an GL_INVALID_OPERATION??

    Originally posted by Roach:
    Code :
    glBegin(GL_LINE_STRIP);
     
    for (azListIter = arcVector_[index].listA_begin();, azListIter != arcVector_[index].listA_.end(); ++azListIter)
    {
       // create the XYZ point from the Az, El,
       // and range from the azListIter
       GlobeXYZ pt;
       createArcPoint(azListIter->az_,
                      azListIter->el_,
                      arcVector_[index].range_,
                      pt);
        double vec[3];
        pt.xyzVector(vec);
        glVertex3dv(vec);
    }
    glEnd();
    You generate temporary objects within the for-loop and pass those pointers to glVertex4DV().

    The pointers will be invalid after the for-loop is complete.
    [/B]
    Hope that helps.

  6. #6
    Senior Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    765

    Re: Will this cause an GL_INVALID_OPERATION??

    Nothing: That should not be a problem. It would be a problem if the pointer was used in GLU's tesselators, but not with standard GL commands.

Similar Threads

  1. nothing rastered, gl_invalid_operation in 3.0
    By DarthPJB in forum OpenGL: Windows
    Replies: 2
    Last Post: 09-22-2011, 07:00 AM
  2. glDrawElements causes GL_INVALID_OPERATION
    By imported_JoshKlint in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 08-05-2011, 11:52 AM
  3. GL_INVALID_OPERATION in glVertexAttribPointer
    By imported_pjcozzi in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-22-2010, 05:42 PM
  4. GL_INVALID_OPERATION on glGetTexImage
    By Cedrick_ in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-16-2010, 05:11 AM
  5. GL_INVALID_OPERATION
    By MickeyMouse in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 11-21-2003, 01:02 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