Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I try to copy the content of vertexDataTextured ArmandDeBrignac [] array into vertexDataTextured MeshVertexData[] array. But it doesn't work.... I think the problem is in the struct method, there are GLKvector elements..... ?

This is my header-File:

struct vertexDataTextured
{
    GLKVector3      vertex;
    GLKVector3      normal;
    GLKVector2      texCoord;
};
typedef struct vertexDataTextured vertexDataTextured;
typedef vertexDataTextured* vertexDataTexturedPtr;


vertexDataTextured MeshVertexData[] = {}; 

vertexDataTextured ArmandDeBrignac[] = {
    {/*v:*/{-0.979979, -2.383373, -1.142941}, /*n:*/{0.000000, -0.725242, -0.688467}, /*t:*/{0.794971, 0.247112}},
    {/*v:*/{-0.859054, -2.367034, -0.829303}, /*n:*/{0.023591, -0.999512, 0.019593}, /*t:*/{0.786435, 0.224949}},
    {/*v:*/{-1.056731, -2.383373, -1.142941}, /*n:*/{-0.337657, -0.631642, -0.697836}, /*t:*/{0.800393, 0.247114}},
    {/*v:*/{-0.979979, -2.117816, -1.142941}, /*n:*/{0.000000, 0.500198, -0.865902}, /*t:*/{0.645127, 0.391262}},
    {/*v:*/{-0.979979, -2.383373, -1.142941}, /*n:*/{0.000000, -0.725242, -0.688467}, /*t:*/{0.663889, 0.391205}},
    {/*v:*/{-1.056731, -2.383373, -1.142941}, /*n:*/{-0.337657, -0.631642, -0.697836}, /*t:*/{0.663906, 0.396627}},
    {/*v:*/{-0.993670, -2.036772, 0.915066}, /*n:*/{-0.771722, 0.588244, 0.241585}, /*t:*/{0.293949, 0.430232}},
};


@interface FlaschenManager : NSObject

-(void) getFlaschenID: (NSString* ) Name andTexture: (NSString*) path;

@end

and my .m File

@implementation FlaschenManager

-(void) getFlaschenID: (NSString* ) Name andTexture: (NSString*) path
{

    if ([Name isEqualToString:@"ArmandDeBrignac"])
    {
        NSLog(@"%@",Name);

        MeshVertexData[0].vertex.v[0]=ArmandDeBrignac[0].vertex.v[0];
      //  MeshVertexData[] = ArmandDeBrignac[];

    } else if ([Name isEqualToString:@"Hennessy"])
    {
        NSLog(@"%@ ", Name);
        FlaschenName = Name;
    }
} 
@end
share|improve this question

1 Answer 1

maybe try something like this

vertexDataTextured ArmandDeBrignac[] = {
    {/*v:*/GLKVertex3Make(-0.979979, -2.383373, -1.142941), /*n:*/GLKVertex3Make(-0.979979, -2.383373, -1.142941), /*t:*/GLKVertex2Make(-0.979979, -2.383373)
}

also you probably want to rather go

MeshVertexData[0].vertex = ArmandDeBrignac[0].vertex;

if you are trying to access index 0 of vertex then use its xyz components instead

MeshVertexData[0].vertex.x = ArmandDeBrignac[0].vertex.x;

have not tested this at all, but its a suggestion

share|improve this answer
    
Thanks for your answer! Now it works to copy the elements! But there is a new Problem, if i copy the above code in my project i get a ARC Semantic Issue failure.... with another Array?... Because i do not alloc memory for my new struct array? – Dominik Seibold Apr 16 '13 at 15:24
    
you will probably need to find out the size of the struct using sizeof() then malloc the new array, and then assign the values – Fonix Apr 16 '13 at 15:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.