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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:20:04+00:00 2026-06-10T20:20:04+00:00

I am trying Rajawali library for Android to draw some basic 3d objects on

  • 0

I am trying Rajawali library for Android to draw some basic 3d objects on the scene.
There is a sample 2000 planes, which show how to render huge amount of vertexes very “cheaply” with one shader. I can pass array of vertexes to the shader and draw them.

I want to upgrade this sample and move some vertexes independently from each other.

I’ve tried glBufferSubData, but i cant change anything on the scene. The one way i’ve found is to change data and recreate buffer, but i hope there is a simpler way to only change the necessary data.

For example, I only want to change some positions from already created and binded buffer.

initialize positions

    float[] planePositions = new float[numVertices * 3];
    ....

create buffer

    mGeometry.createBuffer(mPlanePositionsBufferInfo, BufferType.FLOAT_BUFFER, mPlanePositions,     GLES20.GL_ARRAY_BUFFER);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

set positions

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, planePosBufferHandle);
    GLES20.glEnableVertexAttribArray(maPlanePositionHandle);
    fix.android.opengl.GLES20.glVertexAttribPointer(maPlanePositionHandle, 3, GLES20.GL_FLOAT,
            false, 0, 0);   

and how can i modify position of, for example, the first vertex of the first plane ? (planePositions[0] = a;planePositions[1] = b; planePositions[1] = c… and now i have to pass this modified array to opengl but don’t know how).

  • 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-10T20:20:06+00:00Added an answer on June 10, 2026 at 8:20 pm

    All you need to do is modify the buffer data then call mGeometry.changeBufferData() from the PlanesGalore class. I put the following code in an update method which is called during the onDrawFrame() event of my Renderer class.

    for (int i = 0; i < vertices.length; i += 3) {
       mPlanePositions= mPlanePositions.put(i, mPlanePositions.get(i) - 0.01f);
    }
    
    mGeometry.changeBufferData(mCubePositionsBufferInfo, mPlanePositions, 0);
    

    This is the best way I could find for accomplishing the movements. Additionally, I have proposed a change in this issue that would let you specify what part of the buffer changed which should provide increased performance.

    EDIT

    My change to the engine has been approved so you can now optimize this even further like so.

    // The offset position should be vertices.length * object #. In my use case this is 72*x
    // allowing me to update the XYZ coordinates of all 24 vertices of a cube.
    int offsetPosition = 0;
    mGeometry.changeBufferData(mCubePositionsBufferInfo, mPlanePositions, offsetPosition, offsetPosition + vertices.length);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Rajawali in android (3d opengl library). I am trying to reload material
Trying to link against a static assimp library which I built with MinGW. Here
Trying to prepare good build environment for my js library. According to reviews on
Trying to read in some information from the google maps api into my application
Trying to find some information on this but am unable to get any results
Trying to build Wireshark from source as there is no Linux installer and I
Trying to anonymize received headers for relayed messages from authenticated postfix users, there is
Trying to get the difference between two DateTime objects. With the below code, I
Trying to learn HTML5 and downloaded a test project https://github.com/amiklosi/Comicr . There is a
Trying to find: Show the top-20 PIs who have the largest total amount of

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.