- 浏览: 46845 次
- 性别:
- 来自: 深圳
最新评论
package com.example.android.apis.graphics; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; import javax.microedition.khronos.opengles.GL10; /** * A vertex shaded cube. */ class Cube { public Cube() { int one = 0x10000; /* * 0x10000是出于OPENGL前期内存节约的考虑, 以INT型模拟FLOAT型来表示, 0x 0001 0000 前面4位表示小数点前,后4位表示小数点后, *所以0x10000表示浮点数的1。如果你用的是FloatBuffer,就可以知道此处应该写1.0 */ int vertices[] = {//顶点数组 -one, -one, -one, one, -one, -one, one, one, -one, -one, one, -one, -one, -one, one, one, -one, one, one, one, one, -one, one, one, }; int colors[] = {//颜色数组 0, 0, 0, one, one, 0, 0, one, one, one, 0, one, 0, one, 0, one, 0, 0, one, one, one, 0, one, one, one, one, one, one, 0, one, one, one, }; byte indices[] = {//索引数组,即指定哪3个点构成一个面(三角形) 0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0, 4, 7, 6, 4, 6, 5, 3, 0, 1, 3, 1, 2 }; ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);//建立顶点缓冲 int类型占8个字节,Byte占2个所以*4; vbb.order(ByteOrder.nativeOrder());//设置为本地平台字节顺序。 mVertexBuffer = vbb.asIntBuffer();//将Byte缓冲转为int缓冲。 mVertexBuffer.put(vertices);//放入顶点数组 mVertexBuffer.position(0);//置0; ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4);//颜色缓冲 cbb.order(ByteOrder.nativeOrder()); mColorBuffer = cbb.asIntBuffer(); mColorBuffer.put(colors); mColorBuffer.position(0); mIndexBuffer = ByteBuffer.allocateDirect(indices.length);//索引缓冲。 mIndexBuffer.put(indices); mIndexBuffer.position(0); } public void draw(GL10 gl) { gl.glFrontFace(gl.GL_CW);//确定正面。 gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);//为画笔指定顶点坐标 gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);//为画笔指定顶点颜色 gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);//索引法画图。 } private IntBuffer mVertexBuffer; private IntBuffer mColorBuffer; private ByteBuffer mIndexBuffer; }
发表评论
-
图片处理
2012-11-28 02:48 0http://www.linuxidc.com/Linux/2 ... -
Api Demo - .graphics(24)>>TouchRotateActivity
2012-08-03 15:07 1028package com.example.android.api ... -
Api Demo - .graphics(23)>>CubeMapActivity
2012-07-31 16:31 1378package com.opengl.test; imp ... -
opengles 学习关键字
2012-07-24 09:35 629主动渲染、平面着色、透视投影、near、索引法、glLight ... -
Api Demo - .graphics(21)>>StaticTriangleRenderer
2012-07-23 17:51 1232package com.example.android.api ... -
Api Demo - .graphics(20)>>CompressedTextureActivity
2012-07-23 16:50 1363/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(19)
2012-07-20 22:45 716package com.example.android.api ... -
Api Demo - .graphics(18)
2012-07-20 10:32 816package com.example.android.api ... -
Api Demo - .graphics(17)
2012-07-19 11:43 928/* package com.example.andro ... -
Api Demo - .graphics(16)
2012-07-18 14:54 597package com.example.android.api ... -
Api Demo - .graphics(15)
2012-07-18 12:55 793package com.example.android.api ... -
Api Demo - .graphics(14)
2012-07-18 11:50 802package com.example.android.api ... -
Api Demo - .graphics(13)
2012-07-17 11:38 897//关键字 Paint,MaskFilte,Path,Xfer ... -
Api Demo - .graphics(12)
2012-07-17 10:44 640<?xml version="1.0" ... -
Api Demo - .graphics(11)
2012-07-17 09:53 777//关键字:Shader ,ShapeDrawable pa ... -
Api Demo - .graphics(10)
2012-07-16 17:59 1036/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(9)
2012-07-16 11:26 746//关键字:颜色合成,JPEG,PNG图片解压,Bitmap压 ... -
Api Demo - .graphics(8)
2012-07-16 10:43 646//关键字:ColorMatrixColorFilter; ... -
Api Demo - .graphics(7)
2012-07-16 09:53 723// 关键字:Porter-Duff package c ... -
Api Demo - .graphics(6)
2012-07-16 08:57 760//关键字:截取画布 p ...
相关推荐
cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7cubedemo-0.3.7
提供ESAPI jar包下载 esapi-2.1.0.1.jar
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jdk.version>1.7</jdk.version> <spring.version>4.0.1.RELEASE</spring.version> <spring-data-jpa.version>1.6.2.RELEASE</spring-...
- Camera Window >>DEMO - Cinematics >>DEMO - Content Fitter >>DEMO - Forward Focus >>DEMO - Geometry Boundaries - Limit Distance >>DEMO - Limit Speed >>DEMO - Numeric Boundaries >>DEMO - Pan ...
JavaScript人脸识别库Face-api.js的示例,无需安装nodejs,iis本地直接看效果。注意调用摄像头不能用IP访问,只能localhost,远程预览需要HTTPS;iis无扩展名文件若出现404,需在mime类型中添加扩展名【.】类型...
ViewPagerDemo-2013.1.24.zip ViewPagerDemo-2013.1.24.zip ViewPagerDemo-2013.1.24.zip ViewPagerDemo-2013.1.24.zip
返回json数组的科技头条的api数据jar包
Api-dawn-api-demo.zip,道恩API解调API,一个api可以被认为是多个软件设备之间通信的指导手册。例如,api可用于web应用程序之间的数据库通信。通过提取实现并将数据放弃到对象中,api简化了编程。
包含翻译后的API文档:poi-5.2.0-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.apache.poi:poi:5.2.0; 标签:apache、poi、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index....
Api-demo.zip,API平台的演示应用程序框架API平台演示,一个api可以被认为是多个软件设备之间通信的指导手册。例如,api可用于web应用程序之间的数据库通信。通过提取实现并将数据放弃到对象中,api简化了编程。
<description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot...
根据atmel官方例程sam3x_ek_bertos_http_demo,自己...在keil->Project->Manage->Components,Environment,Books...->Folders/Externsions的 Use GCC的GNU-Tool Folder中指定arm-2012.03-56-arm-none-eabi.exe的安装目录
阿里云青岛节点oss服务报错解决方式 The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. endpoint 根据自己选择的节点...
<div class="demo-description"> <p>The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a ...
open-api-sdk-2.0和jackson,京东宙斯开发jar包,宙斯API包,本人开发使用,open-api-sdk-2.0.jar,jackson-core-asl-1.9.8.jar,jackson-mapper-asl-1.9.8.jar,需要朋友可自行下载
此工程集成了nexus私服,配合我的“nexus搭建和基于spring boot2.x的配置,centos7"博客,可以使用spring boot集成nexus
mybatis-3.2.7.jar source code API configuration.xml settings defaultStatementTimeout 的设置 MyBatisDemo 常用例子 使用3种方法,编写mapper,操作数据库
这是很据android-serialport-api 自己简化的一个demo ,可以使用。原来android-serial-api的程序很多人反映都不能使用,所以自己写了这个,只有一个activity,可以做为你的学习参考。
为了便于NCC开发,前端需在Visual Studio Code中部署脚手架,脚手架里封装了与NCC后端关联的配置,实现前后端分离开发。
GCD常用和不常用API说明GCD_Demo-master.zip