I need a hemisphere in the opera. I found the dresfayer function which I modified to attract half the letters Which ends up halfway) that which I wanted it does it correctly
However, I do not know what to do with the glTexCoordf to map the texture properly on this half needed. I'm not really very good with OpenGL, and I have tried countless changes, but I can not find the text to show it correctly.
Zero dromhemsfire (double r, int lats, int longs) {int i, j; Int half hairs = lat / 2; {Double lat0 = M_PI * (-0.5 + (double) (i - 1) / lets for (i = 0; i & lt; = halflats; i ++); Double z0 = sin (lat0); Double zr0 = cos (lat0); Double Late 1 = Mopi * (-0.5 + (double) I / Lets); Double z1 = sin (lat1); Double zr1 = cos (lat1); GlBegin (GL_QUAD_STRIP); {Double LNG = 2 * MOPI (double) (J-1) / louds for J. (J = 0; J & LT; = Longs; J ++); Double X = Cos (LNG); Double y = sin (lng); // glTexCoordf () glNormal3f (x * zr0, y * zr0, z0); GlVertex3f (x * zr0, y * zr0, z0); // glTexCoordf () glNormal3f (x * zr1, y * zr1, z1); GlVertex3f (x * zr1, y * zr1, z1); } Glend (); }} Does anyone know what prices should be imposed on me? Or what do I need to calculate for it?
Thank you!
Actually, you should not need some fantasy there. Texture Coordination Location ranges from zero to one, then choose some intermediate value for the middle. I can not explain it better without the image, so best I can point you to this article: This is a good starting point. Hope it helps in the form of a starter.
Here's my guess:
{double LNG = 2 * M_PI * (double) (j - 1) / lang; Double X = Cos (LNG); Double y = sin (lng); Double S1, S2, T; S1 = ((double) I) / half late; S2 = ((double) I + 1) / half lathes; T = ((double) j) / long; GlTexCoord2d (s1, t); Glanormal 3D (x * zr0, y * zr0, z0); GlVertex3d (x * zr0, y * zr0, z0); GlTexCoord2d (S2, T); GlNormal3d (x * zr1, y * zr1, z1); GlVertex3d (x * zr1, y * zr1, z1); } Remember to set the texture properly in OpenGL, with an example call:
Glitchycturection (GL_charcher 0); GlMatrixMode (GL_TEXTURE); GlLoadIdentity (); GlMatrixMode (GL_MODELVIEW); // Texture must be bound & amp; Capable texture Bind (); Texture.enable (); DrewhemSpier (1, 40, 40); Texture.disable (); I used the Java + joggle to test it, so this is not a one-to-one C ++ solution, but it should be same. At least you have the appropriate glTexCoord2d () call.
Comments
Post a Comment