Forum Discussion
webstorms
12 years agoHonored Guest
Zoom out
Currently when I display a texture/image to the screen, it seems so close to me. Is there a trick to zoom out and make the image appear further away? Or does the image appear so near because of the im...
webstorms
12 years agoHonored Guest
Instead of using a cube and rendering the texture to it and moving in backwards to achieve a zoomed out effect, I rather wrote this simple method to take care of this:
The only problem is that the image seems to be stretched along the horizontal axis.
private void renderImage(Rectangle dst, float magnification) {
float width, height;
float horizontalOffset, verticalOffset;
// Default: Fill screen horizontally
width = 1f;
height = dst.getHeight()/(float) dst.getWidth();
// magnification
width *= magnification;
height *= magnification;
// Offsets
horizontalOffset = width/2f;
verticalOffset = height/2f;
// Do the actual OpenGL rendering
glBegin (GL_QUADS);
// Right top
glTexCoord2f(0.0f, 0.0f);
glVertex2f(-0.5f + horizontalOffset, verticalOffset);
// Right bottom
glTexCoord2f(0.0f, 1.0f);
glVertex2f(-0.5f + horizontalOffset, -verticalOffset);
// Left bottom
glTexCoord2f(1.0f,1.0f);
glVertex2f(-0.5f - horizontalOffset, -verticalOffset);
// Left top
glTexCoord2f(1.0f, 0.0f);
glVertex2f(-0.5f - horizontalOffset, verticalOffset);
glEnd();
}The only problem is that the image seems to be stretched along the horizontal axis.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 1 year ago
- 11 years ago
- 11 years ago