让纹理贴图在openGL ES(iphone)中工作时遇到很多麻烦.
这就是我所做的:
以下是Jeff Lamarche的教程.获取对象渲染和移动不是问题.
现在我正在尝试获得立方体(实际上是一块瓷砖,Z在X或Y中更窄)以在两个相对的面上粘贴纹理(其他面板可以稍后出现).我已经能够让一张脸上班,但我在任何其他方面都没有得到可行的结果.
在OpenGL ES中纹理映射对象的最系统方法是什么,任何人都可以看到我的代码中的错误在哪里?
#import "GLViewController.h"
#import "ConstantsAndMacros.h"
#import "OpenGLCommon.h"
#import "Cube.h"
@implementation GLViewController
@synthesize initDone;
@synthesize tileArray;
@synthesize tileRows;
@synthesize tileCols;
@synthesize cubes;
@synthesize gridOffsetX;
@synthesize gridOffsetY;
@synthesize gridOffsetZ;
@synthesize tileSpacing;
- (void)drawView:(UIView *)theView
{
static GLfloat rot = 0.0;
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// This is the same result as using Vertex3D, just faster to type and
// can be made const this way
static const Vertex3D vertices[]= { …Run Code Online (Sandbox Code Playgroud)