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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:05:44+00:00 2026-06-10T00:05:44+00:00

I want to move a texture setting a screen coordinates like 270,320 . Right

  • 0

I want to move a texture setting a screen coordinates like 270,320 .
Right now Im rendering the texture setting opengl coordinates (0 to 1) like this:

private final float[] mVerticesData =
        { 
            -1f, 1f, 0.0f, // Position 0
            0.0f, 1.0f, // TexCoord 0
            -1f, -1f, 0.0f, // Position 1
            0.0f, 0.0f, // TexCoord 1
            1f, -1f, 0.0f, // Position 2
            1.0f, 0.0f, // TexCoord 2
            1f, 1f, 0.0f, // Position 3
            1.0f, 1.0f // TexCoord 3
        };
mVertices = ByteBuffer.allocateDirect(mVerticesData.length * 4)
                    .order(ByteOrder.nativeOrder()).asFloatBuffer();
            mVertices.put(mVerticesData).position(0);

and rendering with the following code. Im not setting any matrix or anything…

// Set the viewport
        GLES20.glViewport(0, 0, SimpleTexture2D.screenSize.x, finalHeight);


    //GLES20.glViewport(0, 0, mWidth, mHeight);


    // Clear the color buffer
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    if(useProgram2 == true)
    // Use the program object
    GLES20.glUseProgram(mProgramObject2);
    else
        GLES20.glUseProgram(currentFilter.mProgramObject);

    // Load the vertex position
    mVertices.position(0);
    GLES20.glVertexAttribPointer ( mPositionLoc, 3, GLES20.GL_FLOAT, 
                                   false, 
                                   5 * 4, mVertices );

    // Load the texture coordinate
    mVertices.position(3);
    GLES20.glVertexAttribPointer ( mTexCoordLoc, 2, GLES20.GL_FLOAT,
                                   false, 
                                   5 * 4, 
                                   mVertices );

 // Load the texture coordinate
//        mVertices.position(3);
//        GLES20.glVertexAttribPointer ( mTexCoordLoc2, 2, GLES20.GL_FLOAT,
//                                       false, 
//                                       5 * 4, 
//                                       mVertices );

        GLES20.glEnableVertexAttribArray ( mPositionLoc );
        GLES20.glEnableVertexAttribArray ( mTexCoordLoc );


    // Bind the texture
    //GLES20.glActiveTexture ( GLES20.GL_TEXTURE0 );


    //if(drawOld == true)

        GLES20.glActiveTexture ( GLES20.GL_TEXTURE0 );
        GLES20.glBindTexture ( GLES20.GL_TEXTURE_2D, mTextureId);

        GLES20.glUniform1i ( mTextureIdLoc, 0 );




    currentFilter.onDrawFrame();

    // Set the color matrix uniform unit to 1

    GLES20.glDrawElements ( GLES20.GL_TRIANGLES, 6, GLES20.GL_UNSIGNED_SHORT, mIndices );

Any help

  • 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-10T00:05:46+00:00Added an answer on June 10, 2026 at 12:05 am

    You are probably looking for glOrthof(.0, .0, screenWidt, screenHeight…) instead of viewport.
    Viewport is usually set to draw whole buffer and is set from 0 to buffer dimension. “Ortho” on the other hand will tell at what coordinates are borders of your view you are rendering to.

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

Sidebar

Related Questions

I want to move a part, i.e. one subdirectory of an existing, private mercurial
I want to move image to another x,y position. I try this code but
I want to move an image when I drag on the screen, but the
I want to move image to another x,y coordinates after 3 seconds I try
In this question I asked how to create a mirrored texture and now I
Before all of my messages were in one maildir. Now I want move all
I want to move nodes in nokogiri to a parent. I have this: <root>
I want to move the content of a volume texture along the vector vecShift.
I would like to render image in OpenGL ES, pixel by pixel. I want
I want to move any b2body that is touched on the screen around the

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.