Вопрос не по теме (Opengl es 3)

Программирование на Юнити.

Вопрос не по теме (Opengl es 3)

Сообщение Keyne 17 май 2018, 12:52

Ошибка возникает в момент установки , на устройстве .
Код пишу в Android studio
Проверял на реальном устройстве и на эмуляторе (Genymotion) .

Манифест
Синтаксис:
Используется xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.keyner.artic_7">

    <application
       android:allowBackup="true"
       android:icon="@mipmap/ic_launcher"
       android:label="@string/app_name"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:supportsRtl="true"
       android:theme="@style/AppTheme">
        <activity
           android:name=".Hill"
           android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-feature android:glEsVersion="0x00030000" android:required="true" />
</manifest>
 


Главная активность
Синтаксис:
Используется java
package com.example.keyner.artic_7;

import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.widget.Toast;

public class Hill extends Activity {

    private GLSurfaceView mGLSurfaceView;
    private boolean rendererSet = false;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x30000;

        if (supportsEs2)
        {
            mGLSurfaceView.setEGLContextClientVersion(3);
            mGLSurfaceView.setRenderer(new LessonOneRenderer());rendererSet = true;
        }
        else
        {
            Toast.makeText(this, "This device does not support OpenGL ES 2.0.", Toast.LENGTH_LONG).show(); return;
        }

        setContentView(mGLSurfaceView);
    }


    @Override
    protected void onResume()
    {
        super.onResume();
        if (rendererSet) {
            mGLSurfaceView.onResume();
        }
    }

    @Override
    protected void onPause()
    {
        super.onPause();
        if (rendererSet) {
            mGLSurfaceView.onPause();
        }

    }
}
 


.Renderer
Синтаксис:
Используется java
package com.example.keyner.artic_7;

import android.opengl.GLSurfaceView.Renderer;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import static android.opengl.GLES30.glClearColor;
import static android.opengl.GLES30.glClear;
import static android.opengl.GLES30.glViewport;
import static android.opengl.GLES30.GL_COLOR_BUFFER_BIT;

public class LessonOneRenderer implements Renderer {

    @Override
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {glClearColor(0.0f, 0.0f, 0.1f, 0.5f);
    }

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

    @Override
    public void onDrawFrame(GL10 glUnused) {
        glClear(GL_COLOR_BUFFER_BIT);
    }
}
 
Аватара пользователя
Keyne
UNец
 
Сообщения: 29
Зарегистрирован: 24 фев 2018, 09:18

Вернуться в Скрипты

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 7