CHAPTER 8: Putting It All Together (^283)
[[OpenGLUtils getObject]sphereToRectTheta:15.0[ra floatValue]/DEGREES_PER_RADIAN
phi:[dec floatValue]/DEGREES_PER_RADIAN radius:STANDARD_RADIUS
xprime:&x yprime:&y zprime:&z];
index=j3;
data[index+0]=x;
data[index+1]=y;
data[index+2]=z;
}
nsdata=[[NSData alloc]initWithBytes:data length:numbytes];
[dict setObject:nsdata forKey:@"binarydata"];
As with point sizes, OpenGL will likewise let you vary the width of the lines using
glLineWidth(), which takes a GLfloat as a parameter. glLineWidth() doesn’t know
about Retina scaling, so if you want to have the lines look the same across platforms,
make sure to double the width when appropriate.
One final thing to add: allocation and invocation. In the solar-system controller, allocate
the constellation object, the container for the stars, lines and names, and invoke it. (I’ll
let you figure out when and where.) The Boolean parameters switch on the particular
displayable, needed for when the UI is added:
[m_Constellations execute:TRUE names:m_TRUE];
Now we’re ready to see something. With a little luck and perseverance, you might have
something that looks like Figure 8-8.
singke
(singke)
#1