/*
* CC3OpenGLES11Intercept.c
*
* $Version: cocos3d 0.5-beta (eab7e651f462) on 2011-01-31 $
* Author: Bill Hollings
* Copyright (c) 2010-2011 The Brenwill Workshop Ltd. All rights reserved.
* http://www.brenwill.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* http://en.wikipedia.org/wiki/MIT_License
*
* See header file CC3OpenGLES11Intercept.h for full API documentation.
*/
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include "CC3OpenGLES11Utility.h"
// This file deliberately does NOT include the CC3OpenGLES11Intercept.h file
// because doing so would swap out the actual gl* calls! This implementation
// file must have access to the actual gl* functions.
#ifndef kPrintGLDataVertexCount
# define kPrintGLDataVertexCount 8
#endif
#ifndef kPrintGLDataBufferDataCount
# define kPrintGLDataBufferDataCount 64
#endif
#ifndef kMinGLPointerAddress
# define kMinGLPointerAddress 8192
#endif
void PrintGLData(GLint elemSize, GLenum dataType, GLsizei stride, GLuint elemCount, const GLvoid* pointer) {
if (pointer > (GLvoid*)kMinGLPointerAddress && elemCount) {
size_t dataTypeSize = GLElementTypeSize(dataType);
if (dataTypeSize == 0) {
printf("Illegal GL data type %u", dataType);
}
GLsizei dataTypeStride = stride ? (stride / dataTypeSize) : elemSize;
GLvoid* p = (GLvoid*)pointer;
GLuint printCount = elemCount * dataTypeStride;
printf("\t(");
for (GLuint i = 0; i < printCount; i++, p += dataTypeSize) {
if (i > 0) printf(", ");
if (dataTypeStride > 1 && (i % dataTypeStride == 0)) {
printf("[");
}
switch (dataType) {
case GL_BYTE:
printf("%i", *(GLbyte*)p);
break;
case GL_UNSIGNED_BYTE:
printf("%u", *(GLubyte*)p);
break;
case GL_SHORT:
printf("%i", *(GLshort*)p);
break;
case GL_UNSIGNED_SHORT:
printf("%u", *(GLushort*)p);
break;
case GL_FLOAT:
printf("%.4f", *(GLfloat*)p);
break;
case GL_FIXED:
printf("%i", *(GLfixed*)p);
break;
default:
printf("Cannot print data from illegal data type %u", dataType);
}
if (dataTypeStride > 1 && (i % dataTypeStride == (elemSize - 1))) {
printf("]");
}
}
printf("...)\n");
}
}
#pragma mark OpenGLES base
void glAlphaFuncLogged(GLenum func, GLclampf ref) {
printf("glAlphaFunc(%s, %.2f)\n", GLEnumName(func), ref);
glAlphaFunc(func, ref);
}
void glClearColorLogged(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
printf("glClearColor(%.2f, %.2f, %.2f, %.2f)\n", red, green, blue, alpha);
glClearColor(red, green, blue, alpha);
}
void glClearDepthfLogged(GLclampf depth) {
printf("glClearDepthf(%.2f)\n", depth);
glClearDepthf(depth);
}
void glClipPlanefLogged(GLenum plane, const GLfloat *equation) {
printf("glClipPlanef(%s, %p)\n", GLEnumName(plane), equation);
glClipPlanef(plane, equation);
}
void glColor4fLogged(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
printf("glColor4f(%.2f, %.2f, %.2f, %.2f)\n", red, green, blue, alpha);
glColor4f(red, green, blue, alpha);
}
void glDepthRangefLogged(GLclampf zNear, GLclampf zFar) {
printf("glDepthRangef(%.2f, %.2f)\n", zNear, zFar);
glDepthRangef(zNear, zFar);
}
void glFogfLogged(GLenum pname, GLfloat param) {
printf("glFogf(%s, %.2f)\n", GLEnumName(pname), param);
glFogf(pname, param);
}
void glFogfvLogged(GLenum pname, const GLfloat *params) {
printf("glFogfv(%s, %p)\n", GLEnumName(pname), params);
glFogfv(pname, params);
}
void glFrustumfLogged(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
printf("glFrustumf(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", left, right, bottom, top, zNear, zFar);
glFrustumf(left, right, bottom, top, zNear, zFar);
}
void glGetClipPlanefLogged(GLenum pname, GLfloat *equation) {
printf("glGetClipPlanef(%s, %p)\n", GLEnumName(pname), equation);
glGetClipPlanef(pname, equation);
}
void glGetFloatvLogged(GLenum pname, GLfloat *params) {
printf("glGetFloatv(%s, %p)\n", GLEnumName(pname), params);
glGetFloatv(pname, params);
}
void glGetLightfvLogged(GLenum light, GLenum pname, GLfloat *params) {
printf("glGetLightfv(%s, %s, %p)\n", GLEnumName(light), GLEnumName(pname), params);
glGetLightfv(light, pname, params);
}
void glGetMaterialfvLogged(GLenum face, GLenum pname, GLfloat *params) {
printf("glGetMaterialfv(%s, %s, %p)\n", GLEnumName(face), GLEnumName(pname), params);
glGetMaterialfv(face, pname, params);
}
void glGetTexEnvfvLogged(GLenum env, GLenum pname, GLfloat *params) {
printf("glGetTexEnvfv(%s, %s, %p)\n", GLEnumName(env), GLEnumName(pname), params);
glGetTexEnvfv(env, pname, params);
}
void glGetTexParameterfvLogged(GLenum target, GLenum pname, GLfloat *params) {
printf("glGetTexParameterfv(%s, %s, %p)\n", GLEnumName(target), GLEnumName(pname), params);
glGetTexParameterfv(target, pname, params);
}
void glLightModelfLogged(GLenum pname, GLfloat param) {
printf("glLightModelf(%s, %.2f)\n", GLEnumName(pname), param);
glLightModelf(pname, param);
}
void glLightModelfvLogged(GLenum pname, const GLfloat *params) {
printf("glLightModelfv(%s, %p)\n", GLEnumName(pname), params);
glLightModelfv(pname, params);
}
void glLightfLogged(GLenum light, GLenum pname, GLfloat param) {
printf("glLightf(%s, %s, %.2f)\n", GLEnumName(light), GLEnumName(pname), param);
glLightf(light, pname, param);
}
void glLightfvLogged(GLenum light, GLenum pname, const GLfloat *params) {
printf("glLightfv(%s, %s, %p)\n", GLEnumName(light), GLEnumName(pname), params);
PrintGLData(1, GL_FLOAT, 0, 4, params);
glLightfv(light, pname, params);
}
void glLineWidthLogged(GLfloat width) {
printf("glLineWidth(%.2f)\n", width);
glLineWidth(width);
}
void glLoadMatrixfLogged(const GLfloat *m) {
printf("glLoadMatrixf(%p)\n", m);
glLoadMatrixf(m);
}
void glMaterialfLogged(GLenum face, GLenum pname, GLfloat param) {
printf("glMaterialf(%s, %s, %.2f)\n", GLEnumName(face), GLEnumName(pname), param);
glMaterialf(face, pname, param);
}
void glMaterialfvLogged(GLenum face, GLenum pname, const GLfloat *params) {
printf("glMaterialfv(%s, %s, %p)\n", GLEnumName(face), GLEnumName(pname), params);
PrintGLData(1, GL_FLOAT, 0, 4, params);
glMaterialfv(face, pname, params);
}
void glMultMatrixfLogged(const GLfloat *m) {
printf("glMultMatrixf(%p)\n", m);
glMultMatrixf(m);
}
void glMultiTexCoord4fLogged(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
printf("glMultiTexCoord4f(%s, %.2f, %.2f, %.2f, %.2f)\n", GLEnumName(target), s, t, r, q);
glMultiTexCoord4f(target, s, t, r, q);
}
void glNormal3fLogged(GLfloat nx, GLfloat ny, GLfloat nz) {
printf("glNormal3f(%.2f, %.2f, %.2f)\n", nx, ny, nz);
glNormal3f(nx, ny, nz);
}
void glOrthofLogged(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
printf("glOrthof(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", left, right, bottom, top, zNear, zFar);
glOrthof(left, right, bottom, top, zNear, zFar);
}
void g
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
cocos3d demo (418个子文件)
CC3OpenGLES11Intercept.c 35KB
CC3Kazmath.c 19KB
CC3OpenGLES11Utility.c 12KB
glu.c 3KB
base64.c 2KB
ccUtils.c 366B
LICENSE.cocos2d 1KB
LICENSE.cocos3d 1KB
LICENSE.cocosdenshion 1KB
PVRTModelPOD.cpp 148KB
PVRTGeometry.cpp 42KB
PVRTString.cpp 41KB
PVRTShadowVol.cpp 38KB
PVRTMatrixX.cpp 29KB
PVRTMatrixF.cpp 26KB
PVRTDecompress.cpp 25KB
PVRTTriStrip.cpp 23KB
PVRTVertex.cpp 22KB
PVRTBoneBatch.cpp 22KB
PVRTTextureAPI.cpp 18KB
PVRTVector.cpp 15KB
PVRTTrans.cpp 14KB
PVRTglesExt.cpp 13KB
PVRTMisc.cpp 12KB
PVRTQuaternionX.cpp 10KB
PVRTResourceFile.cpp 10KB
PVRTQuaternionF.cpp 9KB
PVRTBackground.cpp 6KB
PVRTFixedPoint.cpp 6KB
PVRTTexture.cpp 5KB
PVRTError.cpp 2KB
.DS_Store 6KB
teapot.h 195KB
PVRTVector.h 86KB
uthash.h 64KB
CC3Node.h 46KB
PVRTMathTable.h 45KB
PVRTModelPOD.h 39KB
utlist.h 36KB
CC3OpenGLES11StateTracker.h 35KB
CC3World.h 32KB
PVRTString.h 31KB
CC3GLMatrix.h 31KB
PVRTMatrix.h 30KB
CC3VertexArrays.h 28KB
CC3OpenGLES11Intercept.h 24KB
CC3Foundation.h 20KB
CC3PODResource.h 18KB
CC3MeshNode.h 17KB
CC3NodeSequencer.h 17KB
CCNode.h 17KB
PVRTglesExt.h 16KB
CC3ActionInterval.h 15KB
CocosDenshion.h 14KB
CCCompatibility.h 14KB
CCParticleSystem.h 14KB
CC3Material.h 14KB
CC3OpenGLES11VertexArrays.h 14KB
CCMenuItem.h 13KB
CC3OpenGLES11Lighting.h 13KB
CCActionInterval.h 13KB
CCNodeAdornments.h 13KB
ccCArray.h 13KB
CCSprite.h 12KB
CC3OpenGLES11Capabilities.h 11KB
CCTexture2D.h 11KB
CC3BoundingVolumes.h 11KB
CC3NodeAnimation.h 11KB
CC3DemoMashUpWorld.h 11KB
PVRTQuaternion.h 11KB
CCNodeController.h 11KB
PVRTTexture.h 10KB
CC3TargettingNode.h 10KB
CC3Camera.h 10KB
ccConfig.h 10KB
PVRTShadowVol.h 10KB
CC3Billboard.h 9KB
CCDirector.h 9KB
CCLayer.h 9KB
CC3ResourceNode.h 9KB
CDAudioManager.h 9KB
CC3NodeVisitor.h 9KB
CC3Layer.h 9KB
ccMacros.h 8KB
CCTransition.h 8KB
CCEventDispatcher.h 8KB
CCDirectorIOS.h 8KB
CC3Light.h 8KB
CGPointExtension.h 8KB
PVRTFixedPoint.h 8KB
ControllableCCLayer.h 7KB
PVRTTrans.h 7KB
CC3OpenGLES11Engine.h 7KB
CC3MeshModel.h 7KB
CC3Logging.h 7KB
CC3Texture.h 7KB
EAGLView.h 7KB
PVRTGlobal.h 7KB
CCActionGrid3D.h 7KB
CCActionTiledGrid.h 7KB
共 418 条
- 1
- 2
- 3
- 4
- 5
zhuthesea
- 粉丝: 2
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页