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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:41:15+00:00 2026-05-23T10:41:15+00:00

I have a point cloud that I’ve rendered on the Android OpenGL-ES. I can

  • 0

I have a point cloud that I’ve rendered on the Android OpenGL-ES. I can translate it correctly (I think) but when I rotate it, I can’t make it work like it want. I want it to rotate about the center of the point cloud (I have this 3D point), but I don’t know how to do that.

public void onDrawFrame(GL10 gl) {
    // Clears the screen and depth buffer.
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    // Replace the current matrix with the identity matrix
    gl.glLoadIdentity();
    // Translates 4 units into the screen.

    GLU.gluLookAt(gl,   eyeX, eyeY, eyeZ, 
                        centerX, centerY, centerZ, 
                        upX, upY, upZ);

    // rotate
    gl.glRotatef(_xAngle, 1f, 0f, 0f);
    gl.glRotatef(_yAngle, 0f, 1f, 0f);
    gl.glRotatef(_zAngle, 0f, 0f, 1f);

    gl.glTranslatef(_xTranslate, _yTranslate, _zTranslate);

    // Draw things
    ptCloud.draw(gl);
    aBox.draw(gl);
}

I change the _translate and _angle variables in response to user interaction, and in turn the OpenGl would act upon them. You can see I run the draw routin on my prCloud right after my perspective is setup. I’ll show you that:

public void draw(GL10 gl) {
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
    gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glPointSize(0.5f);
    gl.glDrawArrays(GL10.GL_POINTS, 0, numVertices);
    gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}

As well as the create surface method, because I’m not sure if it affects anything:

public void onSurfaceChanged(GL10 gl, int width, int height) {
    // Sets the current view port to the new size.
    gl.glViewport(0, 0, width, height);
    // Select the projection matrix
    gl.glMatrixMode(GL10.GL_PROJECTION);
    // Reset the projection matrix
    gl.glLoadIdentity();
    // Calculate the aspect ratio of the window
    GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.001f,
            1000000.0f);

    // Select the modelview matrix
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    // Reset the modelview matrix
    gl.glLoadIdentity();
}

Here are my lookat default variables:

private float eyeX = 20;
private float eyeY = -150; 
private float eyeZ = 60; 
private float centerX = 0;
private float centerY = 0;
private float centerZ = 0;
private float upX = 0;
private float upY = 0;
private float upZ = 1;

The points have been scaled to be in the range of (0,0,0) to (120,180,38). I also don’t know how to find a eye position that will show the whole model provided random Maximum point values…

Can anyone guess why it won’t rotate how I would expect?

  • 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-23T10:41:15+00:00Added an answer on May 23, 2026 at 10:41 am

    Rotate after you translate!

    Transformation works in the order you tell it to. If you rotate before you translate then the translation is affected by the rotation etc. If you translate before you rotate then the rotation is translated before rotating so it will be at the center of your object.

    See these pages for more information:

    http://www.3dcodingtutorial.com/Basic-OpenGL-functions/Translate-and-Rotate-functions.html

    http://www.swiftless.com/tutorials/opengl/rotation.html

    http://www.opengl.org/resources/faq/technical/transformations.htm

    http://www.falloutsoftware.com/tutorials/gl/gl5.htm

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

Sidebar

Related Questions

I have a point in a rectangle that I need to rotate an arbitrary
I have a very large point cloud (> 100000 points) that I'd like to
Suppose you have a point cloud, and you want a surface that wraps those
Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2},
I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got
I understand that floating point calculations have accuracy issues and there are plenty of
I have a cloud of points that are supposed to represent a face. I
I have a web app hosted in a cloud environment which can be expanded
Context: The Cloud We have a java-based web application that we normally host on
I have an object made of points, lets say its point cloud, i want

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.