TrickPixel Games
TrickPixel Games

Reputation: 23

Android OpenGLES 1.0 Viewport Renders at Wrong Resolution

I am trying to create an OpenGLES 1.0 2D game, in the Orthogonal Projection. It is supposed to run at 1280x720 on my Nexus 7 tablet. It seems to be screen compatibility mode making the viewport downscale to 557x320 as seen in the attached picture.

https://i.sstatic.net/00Lw1.png

The sprites appear choppy and I have tried for hours to fix it. My code is:

@Override
public void onSurfaceChanged(GL10 gl, int width, int height)
{
    gl.glViewport(0, 0, (int)width, (int)height);

    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();

    gl.glOrthof(0.0f, (float)game_width, (float)game_height, 0.0f, 1.0f, -1.0f);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    gl10 = gl;
}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{        
    gl.glEnable(GL10.GL_TEXTURE_2D);
    gl.glEnable(GL10.GL_ALPHA_TEST);
    gl.glAlphaFunc(GL10.GL_GREATER, 0.5f);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    gl.glDisable(GL10.GL_DEPTH_TEST);

    gl10 = gl;

    scene = new SCN_scn_title();
    scene.mgp = this;

}

and my manifest is:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.website.packagenamehere" android:versionCode="1" android:versionName="1.0">
    <application android:label="Block Party" android:icon="@drawable/ic_launcher" allowBackup="true" hardwareAccelerated="true" theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <activity android:name="MainActivity" android:label="Block Party">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission name="android.permission.VIBRATE" />
    <supports-screens xlargeScreens="true" largeScreens="true" normalScreens="true" smallScreens="true" anyDensity="true" resizeable="false" />
    <uses-sdk minSdkVersion="10" targetSdkVersion="15" />
</manifest>

I can't seem to fix this problem and my question is How should I fix this?

Upvotes: 1

Views: 154

Answers (1)

TrickPixel Games
TrickPixel Games

Reputation: 23

The screen attributes , largeScreens, normalScreens, smallScreens, anyDensity, resizeable, and etc. needed the android: prefix.

Upvotes: 1

Related Questions