Convert width to openGL width - Android android.opengl

Android examples for android.opengl:OpenGL

Description

Convert width to openGL width

Demo Code


//package com.book2s;

public class Main {
    /**// w  w w .  ja  v  a  2s.  c om
     * Convert width to openGL width
     * 
     * @param width
     * @return Width in openGL
     */
    public static float toGLWidth(float width, float ratio,
            float screenWidth) {
        return 2.0f * (width / screenWidth) * ratio;
    }
}

Related Tutorials