Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:14:11+00:00 2026-06-07T11:14:11+00:00

I have a display list for some cubes… very simple stuff. Here’s a snippet:

  • 0

I have a display list for some cubes… very simple stuff. Here’s a snippet:

GL11.glPushMatrix
GL11.glRotatef(90,0,0,1)
cuboid(1,0.5,20) //just glVertex calls
GL11.glPopMatrix

If I use this to draw in immediate mode nothing odd happens. However if I put this in a display list it will first draw the cuboid unrotated and then rotated (or whatever transformation I do between glPushMatrix and glPopMatrix). Moreover, if I don’t use glPush and glPop it behaves as expected.

Is there something I should need to know when using glPush/PopMatrix in display lists?

EDIT: adding some more source code:

handle = GL11.glGenLists(1);
GL11.glNewList(handle,GL11.GL_COMPILE)
GL11.glBegin(GL11.GL_LINES);

GL11.glPushMatrix //if I don't use these it behaves as expected
GL11.glRotatef(90,0,0,1)
cuboid(1,0.5,20) //just glVertex calls
GL11.glPopMatrix

GL11.glEnd();
GL11.glEndList();

EDIT2: I’ve made it works by swapping glBegin with glPushMatrix and glEnd with glPopMatrix – I don’t like how it looks now but at least it works. From what I know this is NOT normal and what I’ve done is just a trick, so I’m leaving the question open.

GL11.glPushMatrix //everytime I want to push/pop I have to call glBegin and glEnd
GL11.glBegin(GL11.GL_LINES);
GL11.glRotatef(90,0,0,1)
cuboid(1,0.5,20) //just glVertex calls
GL11.glEnd();
GL11.glPopMatrix
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:14:13+00:00Added an answer on June 7, 2026 at 11:14 am

    It’s an error to call glPushMatrix inside of glBegin/glEnd. There’s only a strict subset of commands that can be used inside of a glBegin/glEnd pair.

    From glBegin man page:

    Only a subset of GL commands can be used between glBegin and glEnd.
    The commands are
    glVertex,
    glColor,
    glSecondaryColor,
    glIndex,
    glNormal,
    glFogCoord,
    glTexCoord,
    glMultiTexCoord,
    glVertexAttrib,
    glEvalCoord,
    glEvalPoint,
    glArrayElement,
    glMaterial, and
    glEdgeFlag.
    Also,
    it is acceptable to use
    glCallList or
    glCallLists to execute
    display lists that include only the preceding commands.
    If any other GL command is executed between glBegin and glEnd,
    the error flag is set and the command is ignored.

    On the man page for glPushMatrix:

    GL_INVALID_OPERATION is generated if glPushMatrix or glPopMatrix
    is executed between the execution of glBegin
    and the corresponding execution of glEnd.

    Start putting glGetError in your development code, it will point out these kinds of problems to you.

    Also glRotatef is not legal there either:

    GL_INVALID_OPERATION is generated if glRotate
    is executed between the execution of glBegin
    and the corresponding execution of glEnd.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code to display a long list of languages inside Rails form
I do have I simple Silverlight Task: Display a List of Supplier objects in
I have to display some info in an unordered list like above: <ul> <li
I have a UIManagedDocument with some data which I display in a list using
With the display list in Actionscript 3.0, I'm often inclined to have children add
I have an AJAX request to display a list of addresses from the users
I have this situation where I want to display a list of Administration objects
I have a List with array of object values. I have to display value
I have been successful with creating a Telerik grid to display a list of
I have an ASP:Repeater Which I would like to display a list of check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.