2
,我有以下我的對象類的硬編碼頂點信息使用的OpenGLES 2.0:在Class更改C-結構的價值觀對OpenGL - 目標C
typedef struct {
float Position[3];
float Color[4];
} Vertex;
static Vertex Vertices [] = {
{{0.0, -0.0, 0}, {1, 0, 0, 1}},
{{0.0 , 50 , 0}, {1, 0, 0, 1}},
{{-50.0, 50.0, 0}, {1, 0, 0, 1}},
{{-50.0, -0.0, 0}, {1, 0, 0, 1}}
};
static GLubyte Indices []= {
0, 1, 2,
2, 3, 0
};
我想要做的就是修改這個類讓我可以在實例化類時設置頂點信息。到目前爲止,我曾嘗試申報,使物體曝光在執行:
@interface StandObject : NSObject {
Vertex * Vertices;
}
@property (nonatomic, assign) Vertex * Vertices;
而且在.m文件
@synthesize Vertices;
然後我嘗試設置頂點如下,但是我覺得格式這裏是錯誤的:
Vertices[0].Position = {0.0, -0.0, 0};
任何人都可以提供的最佳方式的任何意見,以實現這一點,如果我在右邊線?
這給我EXC_BAD_ACCESS? – GuybrushThreepwood
我嘗試了我粘貼的確切代碼,它對我有用,嘗試刪除合成 –
檢查:http://pastebin.com/fpuJ1UEv –