سؤال

I have a problem to load more than one file. Obj in OpenGL. I try to load the cmd file, but only the last file is load.

for(int i=0; i<2; i++){
if(!load_object(argv[i], OBJECT_LIST))){
printf("Error with file %s", argv[i]);
}}

OBJECT_LIST- is GLuint

Where is problem?

هل كانت مفيدة؟

المحلول

It looks like OBJECT_LIST is being overwritten each time the loop iterates. I would imagine making use of an array is what you want:

GLuint OBJECT_LIST[2];

for(int i=0; i<2; i++){
    if(!load_object(argv[i], OBJECT_LIST[i]))){
        printf("Error with file %s", argv[i]);
    }
}

Another note: is there a reason you're starting at argv[0]? That contains your application's filename, not the first argument.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top