Note that there are some explanatory texts on larger screens.

plurals
  1. POgluDisk rotation for mapping
    primarykey
    data
    text
    <p>I'm trying to create sub-cursor for terrain mapping.</p> <p>Basic by code: (old image, but rotation is same)</p> <p><a href="http://www.sdilej.eu/pics/274a90360f9c46e2eaf94e095e0b6223.png" rel="nofollow noreferrer">image http://www.sdilej.eu/pics/274a90360f9c46e2eaf94e095e0b6223.png</a></p> <p>This is when i testing change glRotate ax to my numbers: </p> <p><a href="http://www.sdilej.eu/pics/146bda9dc51708da54b9249706f874fc.png" rel="nofollow noreferrer">image2 http://www.sdilej.eu/pics/146bda9dc51708da54b9249706f874fc.png</a></p> <p>What i want: </p> <p><a href="http://www.sdilej.eu/pics/69721aa237608b423b635945d430e561.png" rel="nofollow noreferrer">image3 http://www.sdilej.eu/pics/69721aa237608b423b635945d430e561.png</a></p> <p>My code:</p> <pre><code>void renderDisk(float x1, float y1, float z1, float x2, float y2, float z2, float radius, int subdivisions, GLUquadricObj* quadric) { float vx = x2 - x1; float vy = y2 - y1; float vz = z2 - z1; //handle the degenerate case of z1 == z2 with an approximation if( vz == 0.0f ) vz = .0001f; float v = sqrt( vx*vx + vy*vy + vz*vz ); float ax = 57.2957795f * acos( vz/v ); if(vz &lt; 0.0f) ax = -ax; float rx = -vy * vz; float ry = vx * vz; glPushMatrix(); glTranslatef(x1, y1, z1); glRotatef(ax, rx, ry, 0.0); gluQuadricOrientation(quadric, GLU_OUTSIDE); gluDisk(quadric, radius - 0.25, radius + 5.0, subdivisions, 5); glPopMatrix(); } void renderDisk_convenient(float x, float y, float z, float radius, int subdivisions) { // Mouse opacity glColor4f( 0.0f, 7.5f, 0.0f, 0.5f ); GLUquadricObj* quadric = gluNewQuadric(); gluQuadricDrawStyle(quadric, GLU_LINE); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_TRUE); renderDisk(x, y, z, x, y, z, radius, subdivisions, quadric); gluDeleteQuadric(quadric); } renderDisk_convenient(posX, posY, posZ, radius, 20); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload