Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You see points because you are drawing points with <code>glBegin(GL_POINTS)</code>. Try replacing it by <code>glBegin(GL_LINE_STRIP)</code>.</p> <p><strong>NOTE:</strong> when you saw the circle you also drew only points, but drawn close enough to appear as a connected circle.</p> <p>Also, you may have not setup the depth buffer to accept values in the range z = [-50, 310] that you use. These arguments should be provided as <em>zNear</em> and <em>zFar</em> clipping planes in your <code>gluPerspective</code>, <code>glOrtho()</code> or <code>glFrustum()</code> call.</p> <p><strong>NOTE:</strong> this would explain why with z value you only see a few points: the other points are clipped because they are outside the z-buffer range.</p> <p><strong>UPDATE AFTER YOU HAVE SHOWN YOUR CODE:</strong></p> <p><code>glOrtho(-100*aspectratio,100*aspectratio,-100,100,1,-1);</code> would only allow z-values in the [-1, 1] range, which is why only the three points with <code>z = -1</code>, <code>z = 0</code> and <code>z = 1</code> will be drawn (thus 3 points).</p> <p>Finally, you're probably viewing the spiral from the top, looking directly in the direction of the rotation axis. If you are not using a perspective projection (but an isometric one), the spiral will still show up as a circle. You might want to change your view with <code>gluLookAt()</code>.</p> <p><strong>EXAMPLE OF SETTING UP PERSPECTIVE</strong></p> <p>The following <a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01" rel="noreferrer">code</a> is taken from the excellent OpenGL tutorials by NeHe:</p> <pre><code>glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix </code></pre> <p>Then, in your <a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02" rel="noreferrer">draw loop</a> would look something like this:</p> <pre><code>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glBegin(GL_TRIANGLES); // Drawing Using Triangles glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); </code></pre> <p>Of course, you should alter this example code your needs.</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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