android - How to set the GLSurfaceView.Renderer class to show the object into surfaceView or the FrameLayout? -


today, i've made 3d object opengl es in android , thinking of displaying other layouts such surfaceview or framelayout in xml or in possible way.

in code below i'm setting gl object oncreate's setcontentview display object. if display glsurfaceview somewhere else how can ? great if can have tips or example!

    glsurfaceview oursurface;       @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);           //setting gl surface view         oursurface = new glsurfaceview(this);         oursurface.setrenderer(new glcuberender());           setcontentview(oursurface);      } 

first should create class extends glsurfaceview constructor see in following example

package com.ball.views;  import android.content.context; import android.opengl.glsurfaceview;  import android.util.attributeset;  public class myglsurfaceview extends glsurfaceview {     public myglsurfaceview(context context, attributeset attrs) {       super(context, attrs);    } } 

after create xml file own glsurfaceview inside

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent">     <com.ball.views.myglsurfaceview        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:id="@+id/glsurfaceview1" />   </linearlayout> 

then change code posted before in order set in view xml file have created , glsurfaceview xml file

myglsurfaceview oursurface;   @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.your_xml_file);     //setting gl surface view     oursurface = (myglsurfaceview)this.findviewbyid(r.id.glsurfaceview1);     oursurface.setrenderer(new glcuberender());  } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -