Putting the phrase "homework project" in this group is probably not going to get you much help, but since I love this subject so much, how about just changing the colors to random combinations they are not already. It should not take too long to find the solution...
On Monday, March 5, 2012 2:06:14 PM UTC-7, geoklee wrote: > > I am having difficulty with my homework project rendering an > octahedron by modifying an existing project that renders a pyramid. > The hint given is to change the vertices, colors, and indices objects. > I did that but the best I could generate is the existing pyramid with > 1 or 2 faces of the inverted pyramid shown while it is rotating on > screen. I have been changing the order of the indices and vertices but > still can not solve the problem. I think these values are correct if I > draw it on paper. I would appreciate some tips to solve the problem as > I have not make any progress after days of fruitless tinkering. > Perhaps I need to modify other code? Thanks in advance! Here are the > values of the vertices, colors, and indices: > > private float[] vertices = { // 6 vertices of the pyramid in (x,y,z) > -1.0f, -1.0f, -1.0f, // 0. left-bottom-back > 1.0f, -1.0f, -1.0f, // 1. right-bottom-back > 1.0f, -1.0f, 1.0f, // 2. right-bottom-front > -1.0f, -1.0f, 1.0f, // 3. left-bottom-front > 0.0f, 1.0f, 0.0f, // 4. top > > //added vertex > 0.0f, -3.0f, 0.0f // 4. bottom > }; > > private float[] colors = { // Colors of the 6 vertices in RGBA > 0.0f, 0.0f, 1.0f, 1.0f, // 0. blue > 0.0f, 1.0f, 0.0f, 1.0f, // 1. green > 0.0f, 0.0f, 1.0f, 1.0f, // 2. blue > 0.0f, 1.0f, 0.0f, 1.0f, // 3. green > 1.0f, 0.0f, 0.0f, 1.0f, // 4. red > > //added color > 1.0f, 1.0f, 0.0f, 0.0f // 5. yellow > }; > > private byte[] indices = { > 2, 4, 3, // front face (CCW) - same as 4,3,2 or 3,2,4 > 4, 2, 1, // right face - same as 2,1,4 or 1,4,2 > 0, 4, 1, // back face - same 4,1,0 or 1,0,4 > 4, 0, 3, // left face - same 0,3,4 or 3,4,2 > > // inverted pyramid > 3, 5, 2, > 2, 5, 1, > 1, 5, 0, > 3, 5, 0, > }; -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en