안드로이드 개발 질문/답변
(글 수 358)
iOS - opengles 소스를 android로 converting하고있습니다.
헌데 C(iOS)에서는 아래 문법이 먹히는데,
struct Vertex{
float Positionp[2];
float Color[4];
};
const Vertex vertices[] = {
{{-0.5,-0.8666} , {1 , 1, 0.5f, 1}},
{{0.5,-0.8666} , {1 , 1, 0.5f, 1}},
{{0,1} , {1 , 1, 0.5f, 1}},
{{-0.5,-0.8666} , {0.5f , 0.5f, 0.5f}},
{{0.5,-0.8666} , {0.5f , 0.5f, 0.5f}},
{{4,-0.4f} , {0.5f , 0.5f, 0.5f}},
};
자바에서는 먹히지 않더군요.
아무리 고민을 해도 답이 나오지 않아 도움을 요청합니다.
2012.07.05 10:13:57
자바는 구조체가 없는걸로 압니다만 'ㅅ ';;
구조체를 Calss로 바꿔서 만들어보세요 ' ㅁ';;
const 키워드도 아마 final로 하셔야 할꺼 같고요 ......
2012.07.05 10:17:43
해보시고 답변좀...그러니까 저걸 자바 문법으로 만들려는데 당연히 class를 사용했지요. 하지만 안됩니다..const final 이나 struct class문제가 아닙니다.
2012.07.05 10:34:58
정확히 어떤 부분이 안되시는건가요?
저는 제대로 나오긴 하는데
public void testA(){
float A[] = {-0.5f, -0.866f};
float B[] = {1, 1, 0.5f, 1};
final Vertex v = new Vertex(A, B);
android.util.Log.d(null, "::: "+v.positionP[0]+v.positionP[1]+v.color[0]);
}
public class Vertex{
float positionP[];
float color[];
public Vertex(float positionP[], float color[]){
super();
this.positionP = positionP;
this.color = color;
}
}
자바는 struct가 없을걸요...?
class로 선언하셔야 할듯해요 ㅎㅎ