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 7886941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:27:01+00:00 2026-06-03T05:27:01+00:00

I want to draw several cubes using glutSolidCube in some points in space. The

  • 0

I want to draw several cubes using glutSolidCube in some points in space. The examples I have found just call glutSolidCube and it works, but the only way a cube gets drawn for me is if the line is enclosed in glBegin(GL_POLYGON), which isn’t required in the examples I’ve seen, and I only get one cube instead of several. What I have is:

glColor3f(1, 0, 0);
glLoadIdentity();
glTranslatef(5,2,1);
glutSolidCube(1);


glLoadIdentity();
glTranslatef(10,8,0);
glutSolidCube(1);

glLoadIdentity();
glTranslatef(3,7,9);
glutSolidCube(1);

glLoadIdentity();
glTranslatef(1,4,6);
glutSolidCube(1);

When I run this nothing happens. I know there’s not a problem with the points being outside my view because if I draw vertices at the same points, I can see them. As far as I can tell from the examples and documentation I’ve read, I’m not doing anything incorrect. Can someone tell me what I’m doing wrong or give me a snippet of code that draws multiple cubes?

  • 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-03T05:27:03+00:00Added an answer on June 3, 2026 at 5:27 am

    Try this:

    glColor3f(1, 0, 0);
    glPushMatrix();
    glTranslatef(5,2,1);
    glutSolidCube(1);
    glPopMatrix();
    
    glPushMatrix();
    glTranslatef(10,8,0);
    glutSolidCube(1);
    glPopMatrix();
    
    glPushMatrix();
    glTranslatef(3,7,9);
    glutSolidCube(1);
    glPopMatrix();
    
    glPushMatrix();
    glTranslatef(1,4,6);
    glutSolidCube(1);
    glPopMatrix();
    

    Without re-setting the model view matrix with glLoadIdentity(). Note that to start with you need to call glOrtho() or glPerspective() to set the camera once.

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

Sidebar

Related Questions

I have overridden the drawRect: in my UIView and I want to draw several
I draw several 2D shapes using OpenGL and now I want to add the
I want to draw some lines and rectangles on a panel. Sometimes it does
I want to draw some listview items disabled and would like to mimic the
I want to draw this in my view to draw this line, I have
I want to draw some hlines and vlines snapped to occupy whole pixels on
I have found several tutorials for older versions of Maya, but, since I am
I have a panel (here called parent), where I draw a calculated picture. Some
Hey I want to draw several circles in R with different radius. I did
I have a PDF file that I want to draw in outline form. I

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.