开发者

Storing texture name in objects - obj-c

I'm in the process of learning opengles / obj-c and creating an app for the iphone that will render multiple 3d models. I've created an object that stores all the important details such as vertices / faces / textures etc but I also want to store the texture name that is currently being used on the model. In my CustomModels.h file I have:

@interface CustomModels : NSObject {    
  Vertex3D           *vertices;
  int                numberOfFaces;
  Face3D             *faces;
  Tex3D              *texCoords;
  BOOL               active;
  NSMutableArray    *textures;

  GLuint            activeTexture;
}

then in my view controller .m file I'm trying to store the texture name like this:

glGenTextures(1, oModel.activeTexture);

But re开发者_JAVA百科ceive this error:

lvalue required as unary '&' operand

I'm a complete starter in obj-c programming so if anyone can point me in the right direction it would be much appreciated! Many thanks!


glGenTextures expects a pointer to a GLuint as its second parameter. You cannot use an Objective-C property (which is just another way of writing [oModel activeTexture]) in this place. Use a temp local variable instead:

GLuint texture = 0;
glGenTextures(1, &texture);
oModel.activeTexture = texture;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜