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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:19:18+00:00 2026-06-01T11:19:18+00:00

I draw a simple triangle and I want to learn how to rotate it

  • 0

I draw a simple triangle and I want to learn how to rotate it and move in up and down and left and right . I add gl.glRotatef(0.0f, 1.0f, 0.0f, 0.0f) but it does not rotate.

this is my code :

public class GLrenderer implements Renderer {
public GLqueue tri;

public GLrenderer() {
    tri = new GLqueue();

}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
    // TODO Auto-generated method stub
    gl.glDisable(GL10.GL_DITHER);
    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
    gl.glClearColor(.8f, .0f, .2f, 1);
    gl.glClearDepthf(1f);
}

@Override
public void onDrawFrame(GL10 gl) {
    // TODO Auto-generated method stub
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_COLOR_BUFFER_BIT);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();
    GLU.gluLookAt(gl, 0, 0, 10f , 0 , 0 , 0 , 0 ,2, 0);
    tri.draw(gl);
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    // TODO Auto-generated method stub
    gl.glViewport(0, 0, width, height);
    float ratio = (float) width/height;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glFrustumf(-ratio, ratio , -1, 1, 1, 25);

}

}

  • 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-01T11:19:19+00:00Added an answer on June 1, 2026 at 11:19 am
    gl.glPushMatrix();
    gl.Translatef(x,y,0)
    gl.Rotatef(45,0,0,1)//rotate the object 45 degress in z axis
    DrawObjuect();
    gl.glPopMatrix();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not very familiar with OpenGL but I tried to draw a simple
Let's say I want to draw a simple quad like this: glBegin(GL_QUADS); glVertex2f(-1.0,-1.0); glVertex2f(1.0,-1.0);
I want to draw a rectangle using OPENGL in Android... Just a simple rectangle
What i want to do is draw simple shape let's say rectangle by mouse
I want to draw a triangle and elide text in the shape. I can
Are there any good tutorials on how to draw a simple triangle in DirecX
I want to draw a simple line on the iPhone by touching and dragging
Lets say I want to draw a simple 3D hero with OpenGL. Here are
I need to draw some simple network topology charts, suggestions of some good tools
I'm trying to just draw a simple image from the drawable-mdpi folder in android

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.