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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:11:47+00:00 2026-05-29T22:11:47+00:00

I want to render 2D images. To do this I scale and transform everything

  • 0

I want to render 2D images. To do this I scale and transform everything into position with the centre being where I want it. I need to rotate the 2D coordinates around the centre but when I do this it is as if there was some x coordinate involved since the images are flattened out strangely. Here is the code:

attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
uniform vec2 scale;
uniform vec2 trans;
uniform float move_down;
void main(){ 
    gl_Position = vPosition;
    gl_Position.x *= scale.x;
    gl_Position.y *= scale.y;
    gl_Position.x += trans.x;
    gl_Position.y += trans.y - move_down;
    gl_Position.x *= 2.0;
    gl_Position.y *= 2.0;
    gl_Position.x -= 1.0;
    gl_Position.y -= 1.0;
    gl_Position.x *= 0.2; //For visual testing only
    gl_Position.y *= 0.2; //Same
    gl_Position.x = cos(1.0)*gl_Position.x - sin(1.0)*gl_Position.y;
    gl_Position.y = sin(1.0)*gl_Position.x + cos(1.0)*gl_Position.y;
    v_texCoord = a_texCoord;
}

Here is the image without the rotation lines…

Images are cropped down

And here is the image with the rotation at 1.0 radians…

enter image description here

Clearly there is an issue, since it should be a simple 2D rotation. If I do 90 degrees the image disappears completely.

Done with OpenGL-ES 2 for Android.

I appreciate any answers to this.

Edit: I also tried this with the same problem:

mat4 RotationMatrix = mat4( cos(1.0), -sin(1.0), 0.0, 0.0,
                               sin(1.0),  cos(1.0), 0.0, 0.0,
                               0.0,           0.0, 1.0, 0.0,
                               0.0,           0.0, 0.0, 1.0 );
    gl_Position *= RotationMatrix;
  • 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-29T22:11:53+00:00Added an answer on May 29, 2026 at 10:11 pm

    I was multiplying the matrix after the vector… Wrong way around. The Matrix works when it is done as:

    gl_Position = RotationMatrix * Position;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to render a partial depending on a selection in selection box. This
Well I want to render a self closing tag say <img> tag like this
I need to render quite alot (tens of thousands) images off-screen using OpenGL. I
I have an android application. I want to use OpenGL to render my images
I want to render a profile user container that contains a list of labels
i want to render one of these sets of views: head body-$id1 foot OR
Following problem: I want to render a news stream of short messages based on
In my Application_Error event handler i want to render an MVC-View for 404. I
I have a 3rd party ActiveX control I want to render within other presentation
If I have an object say @user and I want to render only certain

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.