/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.apis.graphics.spritetext;
import android.util.Log;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL10Ext;
import javax.microedition.khronos.opengles.GL11;
import javax.microedition.khronos.opengles.GL11Ext;
/**
* Allows retrieving the current matrix even if the current OpenGL ES
* driver does not support retrieving the current matrix.
*
* Note: the actual matrix may differ from the retrieved matrix, due
* to differences in the way the math is implemented by GLMatrixWrapper
* as compared to the way the math is implemented by the OpenGL ES
* driver.
*/
class MatrixTrackingGL implements GL, GL10, GL10Ext, GL11, GL11Ext {
private GL10 mgl;
private GL10Ext mgl10Ext;
private GL11 mgl11;
private GL11Ext mgl11Ext;
private int mMatrixMode;
private MatrixStack mCurrent;
private MatrixStack mModelView;
private MatrixStack mTexture;
private MatrixStack mProjection;
private final static boolean _check = false;
ByteBuffer mByteBuffer;
FloatBuffer mFloatBuffer;
float[] mCheckA;
float[] mCheckB;
public MatrixTrackingGL(GL gl) {
mgl = (GL10) gl;
if (gl instanceof GL10Ext) {
mgl10Ext = (GL10Ext) gl;
}
if (gl instanceof GL11) {
mgl11 = (GL11) gl;
}
if (gl instanceof GL11Ext) {
mgl11Ext = (GL11Ext) gl;
}
mModelView = new MatrixStack();
mProjection = new MatrixStack();
mTexture = new MatrixStack();
mCurrent = mModelView;
mMatrixMode = GL10.GL_MODELVIEW;
}
// ---------------------------------------------------------------------
// GL10 methods:
public void glActiveTexture(int texture) {
mgl.glActiveTexture(texture);
}
public void glAlphaFunc(int func, float ref) {
mgl.glAlphaFunc(func, ref);
}
public void glAlphaFuncx(int func, int ref) {
mgl.glAlphaFuncx(func, ref);
}
public void glBindTexture(int target, int texture) {
mgl.glBindTexture(target, texture);
}
public void glBlendFunc(int sfactor, int dfactor) {
mgl.glBlendFunc(sfactor, dfactor);
}
public void glClear(int mask) {
mgl.glClear(mask);
}
public void glClearColor(float red, float green, float blue, float alpha) {
mgl.glClearColor(red, green, blue, alpha);
}
public void glClearColorx(int red, int green, int blue, int alpha) {
mgl.glClearColorx(red, green, blue, alpha);
}
public void glClearDepthf(float depth) {
mgl.glClearDepthf(depth);
}
public void glClearDepthx(int depth) {
mgl.glClearDepthx(depth);
}
public void glClearStencil(int s) {
mgl.glClearStencil(s);
}
public void glClientActiveTexture(int texture) {
mgl.glClientActiveTexture(texture);
}
public void glColor4f(float red, float green, float blue, float alpha) {
mgl.glColor4f(red, green, blue, alpha);
}
public void glColor4x(int red, int green, int blue, int alpha) {
mgl.glColor4x(red, green, blue, alpha);
}
public void glColorMask(boolean red, boolean green, boolean blue,
boolean alpha) {
mgl.glColorMask(red, green, blue, alpha);
}
public void glColorPointer(int size, int type, int stride, Buffer pointer) {
mgl.glColorPointer(size, type, stride, pointer);
}
public void glCompressedTexImage2D(int target, int level,
int internalformat, int width, int height, int border,
int imageSize, Buffer data) {
mgl.glCompressedTexImage2D(target, level, internalformat, width,
height, border, imageSize, data);
}
public void glCompressedTexSubImage2D(int target, int level, int xoffset,
int yoffset, int width, int height, int format, int imageSize,
Buffer data) {
mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width,
height, format, imageSize, data);
}
public void glCopyTexImage2D(int target, int level, int internalformat,
int x, int y, int width, int height, int border) {
mgl.glCopyTexImage2D(target, level, internalformat, x, y, width,
height, border);
}
public void glCopyTexSubImage2D(int target, int level, int xoffset,
int yoffset, int x, int y, int width, int height) {
mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
height);
}
public void glCullFace(int mode) {
mgl.glCullFace(mode);
}
public void glDeleteTextures(int n, int[] textures, int offset) {
mgl.glDeleteTextures(n, textures, offset);
}
public void glDeleteTextures(int n, IntBuffer textures) {
mgl.glDeleteTextures(n, textures);
}
public void glDepthFunc(int func) {
mgl.glDepthFunc(func);
}
public void glDepthMask(boolean flag) {
mgl.glDepthMask(flag);
}
public void glDepthRangef(float near, float far) {
mgl.glDepthRangef(near, far);
}
public void glDepthRangex(int near, int far) {
mgl.glDepthRangex(near, far);
}
public void glDisable(int cap) {
mgl.glDisable(cap);
}
public void glDisableClientState(int array) {
mgl.glDisableClientState(array);
}
public void glDrawArrays(int mode, int first, int count) {
mgl.glDrawArrays(mode, first, count);
}
public void glDrawElements(int mode, int count, int type, Buffer indices) {
mgl.glDrawElements(mode, count, type, indices);
}
public void glEnable(int cap) {
mgl.glEnable(cap);
}
public void glEnableClientState(int array) {
mgl.glEnableClientState(array);
}
public void glFinish() {
mgl.glFinish();
}
public void glFlush() {
mgl.glFlush();
}
public void glFogf(int pname, float param) {
mgl.glFogf(pname, param);
}
public void glFogfv(int pname, float[] params, int offset) {
mgl.glFogfv(pname, params, offset);
}
public void glFogfv(int pname, FloatBuffer params) {
mgl.glFogfv(pname, params);
}
public void glFogx(int pname, int param) {
mgl.glFogx(pname, param);
}
public void glFogxv(int pname, int[] params, int offset) {
mgl.glFogxv(pname, params, offset);
}
public void glFogxv(int pname, IntBuffer params) {
mgl.glFogxv(pname, params);
}
public void glFrontFace(int mode) {
mgl.glFrontFace(mode);
}
public void glFrustumf(float left, float right, float bottom, float top,
float near, float far) {
mCurrent.glFrustumf(left, right, bottom, top, near, far);
mgl.glFrustumf(left, right, bottom, top, near, far);
if ( _check) check();
}
public void glFrustumx(int left, int right, int bottom, int top, int near,
int far) {
mCurrent.glFrustumx(left, right, bottom, top, near, far);
mgl.glFrustumx(left, right, bottom, top, near, f
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
android api demo 源码 (603个子文件)
IRemoteService.aidl 1KB
ISecondary.aidl 1KB
IRemoteServiceCallback.aidl 1KB
animated_gif.gif 34KB
frog.gif 3KB
MatrixTrackingGL.java 32KB
List6.java 18KB
List13.java 18KB
List14.java 17KB
List4.java 17KB
List9.java 17KB
LabelMaker.java 14KB
List1.java 13KB
AlertDialogSamples.java 13KB
Kube.java 12KB
SpriteTextRenderer.java 11KB
TouchPaint.java 10KB
StatusBarNotifications.java 10KB
RemoteServiceBinding.java 9KB
SearchInvoke.java 9KB
Sensors.java 9KB
DensityActivity.java 8KB
InternalSelectionView.java 8KB
ColorPickerDialog.java 8KB
Grid2.java 8KB
StaticTriangleRenderer.java 8KB
TriangleRenderer.java 7KB
ServiceStartArguments.java 7KB
MediaPlayerDemo_Video.java 7KB
FingerPaint.java 7KB
SensorTest.java 7KB
AlarmController.java 7KB
Xfermodes.java 7KB
ForegroundService.java 7KB
RemoteService.java 7KB
MenuInflateFromXml.java 6KB
PreferencesFromCode.java 6KB
Transition3d.java 6KB
BitmapPixels.java 6KB
ColorFilters.java 6KB
LabelView.java 6KB
LauncherShortcuts.java 6KB
ExpandableList1.java 6KB
ReceiveResult.java 6KB
TouchRotateActivity.java 6KB
MorseCodeConverter.java 6KB
MatrixStack.java 5KB
TextAlign.java 5KB
MyPreference.java 5KB
ExampleAppWidgetProvider.java 5KB
ShapeDrawable1.java 5KB
ForwardingTest.java 5KB
BitmapDecode.java 5KB
PictureLayout.java 5KB
CreateBitmap.java 5KB
AutoComplete6.java 5KB
NotifyingService.java 5KB
DateWidgets1.java 5KB
ExampleAppWidgetConfigure.java 5KB
ApiDemos.java 5KB
Focus2ActivityTest.java 5KB
PersistentState.java 5KB
AutoComplete1.java 5KB
TextToSpeechActivity.java 5KB
AlarmService_Service.java 4KB
Focus2AndroidTest.java 4KB
SearchQueryResults.java 4KB
ColorMatrixSample.java 4KB
Grid.java 4KB
BitmapMesh.java 4KB
QuickContactsDemo.java 4KB
Gallery1.java 4KB
List8.java 4KB
RedirectMain.java 4KB
LocalService.java 4KB
RoundRects.java 4KB
Regions.java 4KB
Patterns.java 4KB
IncomingMessage.java 4KB
PurgeableBitmapView.java 4KB
LocalServiceBinding.java 4KB
ScaleToFit.java 4KB
LaunchingPreferences.java 4KB
PathEffects.java 4KB
MeasureText.java 4KB
PurgeableBitmap.java 4KB
Arcs.java 4KB
AutoComplete4.java 4KB
ImageSwitcher1.java 4KB
UnicodeChart.java 4KB
Animation3.java 4KB
PolyToPoly.java 4KB
Compass.java 4KB
SaveRestoreState.java 4KB
SurfaceViewOverlay.java 4KB
VoiceRecognition.java 4KB
Vertices.java 4KB
MediaPlayerDemo.java 4KB
Clipping.java 4KB
LinearLayout8.java 4KB
共 603 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- xgw10082012-08-16谢谢,如果是个安整的工程就好了
- sjoyunny2012-05-31很好,因为不想花时间去下源码,找到这个真好。
- 亢龙2013-02-06android 模拟器中API Demo里面所有例子的代码集合,只是看着有点不方便,找的稍微有点痛苦
cwx01perfect
- 粉丝: 47
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 批量将py编译为pyd文件.atbx
- Python项目-学生管理系统
- verilog HDL硬件语法设计包括算术运算三人表决器Verilog的阻塞和非阻塞赋值源码例程quartus13.1工程合集
- 【文章话题分类论文】OpenAlex Topic Classification Whitepaper
- linux学习常用命令
- 功率拓扑快速参考指南-ti,TI官方出品
- 开关电源拓朴图表,各种电路拓扑表格
- 登录和注册 前端:vue3+iview plus +axios 后台:spring boot +mybatis
- 软件测试入门简介:从基础到实践的全面介绍
- 2024CDA Level Ⅰ 认证考试大纲
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功