Discussion:
Resizing a 2D OpenGL ES Texture/Sprite during render
powerdroid
2012-08-13 18:03:57 UTC
Permalink
I wonder if it is possible (and if so, how it is done) to scale a 2D
Texture/Sprite during rendering. For example, I have a 128x128 image that
I will load and use for the texture, but I would like to draw that image
sometimes as 100%, sometimes as 85% of its size, and sometimes as 70% of
its size to the screen (all in the same frame). Is there a way to do such
a thing or would each image need to be resized in a graphic editor and
loaded separately?

PD
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Harri Smått
2012-08-13 18:11:25 UTC
Permalink
I wonder if it is possible (and if so, how it is done) to scale a 2D Texture/Sprite during rendering.
Once you render an image to screen you have two things for it;

1. Vertex positions in 2D space.
2. Texture coordinates for vertices.

Altering vertex positions will scale your image "automatically".

--
H
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
powerdroid
2012-08-13 18:50:48 UTC
Permalink
So, in a sense we move the sprite in the Z axis and that determines the
size it will be on the screen, correct?
Post by powerdroid
Post by powerdroid
I wonder if it is possible (and if so, how it is done) to scale a 2D
Texture/Sprite during rendering.
Once you render an image to screen you have two things for it;
1. Vertex positions in 2D space.
2. Texture coordinates for vertices.
Altering vertex positions will scale your image "automatically".
--
H
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Harri Smått
2012-08-13 18:57:00 UTC
Permalink
So, in a sense we move the sprite in the Z axis and that determines the size it will be on the screen, correct?
You can alter x/y coordinates also which may make it easier too as you don't have to worry about depth buffer. Making it (x, y, 0) coordinates only you can translate to correct position with desired scaling etc using model matrices.

--
H
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Loading...