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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:20:31+00:00 2026-05-21T22:20:31+00:00

I want to draw a cube and translate it, but the transformations on the

  • 0

I want to draw a cube and translate it, but the transformations on the Model View matrix don’t seem to work. They have 0 effect.

gl.glClearColor(0, 0, 0, 0);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glClear(gl.GL_DEPTH_BUFFER_BIT);
gl.glFrustum(-10, 10, -10, 10, 0.01, 20);



gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();
    gl.glTranslated(0.8, 0, 0); //no effect
    gl.glRotated(30, 1, 0, 0); //no effect
    drawCube(gl);

public void drawCube(GL gl) {

    gl.glMatrixMode(GL.GL_MODELVIEW);

    //spate
    gl.glLoadIdentity();
    drawSquare(gl);
    //fata
    gl.glLoadIdentity();
    gl.glTranslated(0, 0, WIDTH);
    drawSquare(gl);

    //st
    gl.glLoadIdentity();
    gl.glRotated(-90, 0, 1, 0);
    drawSquare(gl);

    //dr
    gl.glLoadIdentity();
    gl.glRotated(-90, 0, 1, 0);
    gl.glTranslated(0, 0, -WIDTH);
    drawSquare(gl);

    //sus
    gl.glLoadIdentity();
    gl.glRotated(90, 1, 0, 0);
    drawSquare(gl);
    //jos
    gl.glLoadIdentity();
    gl.glRotated(90, 1, 0, 0);
    gl.glTranslated(0, 0, -WIDTH);
    drawSquare(gl);

}

public void drawSquare(GL gl) {
    gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);
    gl.glBegin(GL.GL_POLYGON);
        gl.glTexCoord2d(0, 0);
        gl.glVertex3d(0, 0,0);

        gl.glTexCoord2d(0, 1);
        gl.glVertex3d(0, WIDTH,0);

        gl.glTexCoord2d(1, 1);
        gl.glVertex3d(WIDTH, WIDTH,0);

        gl.glTexCoord2d(1, 0);
        gl.glVertex3d(WIDTH, 0,0);
    gl.glEnd();
}
  • 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-05-21T22:20:32+00:00Added an answer on May 21, 2026 at 10:20 pm

    Inside drawCube() you’re resetting the modelview matrix:

    gl.glMatrixMode(GL.GL_MODELVIEW);
    
    //spate
    gl.glLoadIdentity();
    

    I suspect you want to use glPushMatrix() and glPopMatrix() here.

    As a side note: those operations are deprecated since OpenGL 3.1.

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

Sidebar

Related Questions

I want to draw image(bmp) using an image pointer by VS2005(MFC). But I don't
I want to draw five rectangle bars in Android. I have the regtangles, but
I draw a cube with OpenGL ES and I want to have an above
i want to draw line, i have two textfiled in which i enter some
I want to Draw multiple line Graph with each line have different color and
I want to draw text view with 2 color like the text in this
I have a cube with ofcourse 6 sides. Now I want not to render
I am trying to draw a solid cube in C++ using OpenGl feature but
Say we want to render a cube. To draw a geometry we need only
I want to draw UIButton in following shape : I have cut the image,

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.