- C++
- Interaction developer
- Android
- postman html parse
- postman tests
- Android/iOS Developer
- postman
- LSL_Script
- 우수한 프런트 개발자
- postman session
- oracle
- postman collection
- web developer
- PL/SQL
- postman pre-request
- UI/UX Engineer
- Intellij
- 좋은 개발자
- postman csv
- Front-end developer
- Unity
- postman excel
- c#
- MFC
- postman automations
- emplace_back
- 프런트엔드
- postman collection variables
- Java
- solidity
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Today
- Total
david's daily developer note
[OpenGL ES]OpenGL 로 원하는 도형 만들기 본문
class Cube
{
public Cube()
{
int one = 0x10000;
int vertices[] = {
//x, y, z,
-one, -one, -one, // index #0
one, -one, -one, // index #1
one, one, -one, // index #2
-one, one, -one, // index #3
-one, -one, one, // index #4
one, -one, one, // index #5
one, one, one, // index #6
-one, one, one, // index #7
};
int colors[] = {
//R, G, B, A
0, 0, 0, one,
one, 0, 0, one,
one, one, 0, one,
0, one, 0, one,
0, 0, one, one,
one, 0, one, one,
one, one, one, one,
0, one, one, one,
};
byte indices[] = {
// Triangle 로 쪼개는 인덱스 번호들
0, 4, 5, 0, 5, 1,
1, 5, 6, 1, 6, 2,
2, 6, 7, 2, 7, 3,
3, 7, 4, 3, 4, 0,
4, 7, 6, 4, 6, 5,
3, 0, 1, 3, 1, 2,
};
// Buffers to be passed to gl*Pointer() functions
// must be direct, i.e., they must be placed on the
// native heap where the garbage collector cannot
// move them.
//
// Buffers with multi-byte datatypes (e.g., short, int, float)
// must have their byte order set to native order
ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
vbb.order(ByteOrder.nativeOrder());
mVertexBuffer = vbb.asIntBuffer();
mVertexBuffer.put(vertices);
mVertexBuffer.position(0);
ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4);
cbb.order(ByteOrder.nativeOrder());
mColorBuffer = cbb.asIntBuffer();
mColorBuffer.put(colors);
mColorBuffer.position(0);
mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
mIndexBuffer.put(indices);
mIndexBuffer.position(0);
}
public void draw(GL10 gl)
{
gl.glFrontFace(gl.GL_CW);
gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);
gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);
gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);
}
private IntBuffer mVertexBuffer;
private IntBuffer mColorBuffer;
private ByteBuffer mIndexBuffer;
}
'Develop (kids)' 카테고리의 다른 글
AnkhSvn 클라이언트 사용하기 (0) | 2012.02.29 |
---|---|
[3DMax]Box Object 면 단위 텍스쳐입히기. (0) | 2011.07.14 |
WMF2EPS 설치 (0) | 2011.06.24 |
[OpenGL ES] Cube Renderer Class (0) | 2011.06.24 |
LSL_Script 객체 텍스쳐 입히기 (0) | 2011.05.24 |