Android加载三维模型

这几天在Android项目中需要加载三维模型,找了多种方法,最后决定使用jpct引擎。话不多说,上代码。

一、代码解析

首先创建一个活动MainActivity,活动布局如下:

包括五个button,一个ImageView作为背景,一个GLSurfaceView显示模型,布局代码如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/screen"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorBg"/>
    <android.opengl.GLSurfaceView
        android:id="@+id/surfaceView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="180dip"
        android:orientation="vertical">
    <Button
        android:id="@+id/btnLoadModel"
        android:layout_width="match_parent"
        android:layout_height="60dip"
        android:text="loadModel"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dip"
            android:orientation="horizontal">
            <Button
                android:id="@+id/btnLeft"
                android:layout_width="180dip"
                android:layout_height="60dip"
                android:text="left"/>
            <Button
                android:id="@+id/btnRight"
                android:layout_width="180dip"
                android:layout_height="60dip"
                android:text="right"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dip"
            android:orientation="horizontal">
            <Button
                android:id="@+id/btnTop"
                android:layout_width="180dip"
                android:layout_height="60dip"
                android:text="top"/>
            <Button
                android:id="@+id/btnDown"
                android:layout_width="180dip"
                android:layout_height=
  • 6
    点赞
  • 43
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值