How to calculate vertext normals for a mesh in Java in OpenGL ES application?
Posted
by
alan mc
on Game Development
See other posts from Game Development
or by alan mc
Published on 2011-02-16T11:28:29Z
Indexed on
2011/02/16
15:34 UTC
Read the original article
Hit count: 285
opengl-es
Can some one point me to Java code ( in Java not C or C++) that calculates all the normals for all the vertices of a mesh for OpenGL ES application. I need this for lighting. Lets say I have a cube with following vertices and indices:
float vertices[] = { -width, -height, -depth, // 0
width, -height, -depth, // 1
width, height, -depth, // 2
-width, height, -depth, // 3
-width, -height, depth, // 4
width, -height, depth, // 5
width, height, depth, // 6
-width, height, depth // 7
};
short indices[] = { 0, 2, 1,
0, 3, 2,
1,2,6,
6,5,1,
4,5,6,
6,7,4,
2,3,6,
6,3,7,
0,7,3,
0,4,7,
0,1,5,
0,5,4
};
In above specific example how many normals we need ?
© Game Development or respective owner