Re: Draw a circle in OpenGL



Barry Fishman wrote:
Elvis Nguyen <nvntung@xxxxxxxxx> writes:
Somebody test the snippets code below

(require '#:asdf)
(asdf:oos 'asdf:load-op '#:cl-glfw)
(asdf:oos 'asdf:load-op '#:cl-glfw-opengl)
(asdf:oos 'asdf:load-op '#:cl-glfw-glu)

(defconstant +DEG2RAD+ (/ 3.14159 180))

(glfw:do-window ("A Circle Example")
((gl:with-setup-projection
(glu:perspective 45 4/3 0.1 50)))
(gl:clear gl:+color-buffer-bit+)
(gl:load-identity)
(gl:translate-f 0 0 -5)

(draw-circle 100))

(defun draw-circle (radius)
(gl:with-begin gl:+line-strip+
(let ((degInRad 0))
(dotimes (i 360)
(setf degInRad (* i +DEG2RAD+))
(gl:vertex-3f (* (cos degInRad) radius) (* (sin degInRad)
radius) 0)))))

My purpose is to draw a circle using cl-glfw. The rusult is nothing. I
have tested many times.

You are trying to look at a 100 unit radius circle from 5 units away.
You need to draw a smaller circle "(draw-circle 1)", or look at it from
further away like:

(gl:translate-f 0 0 -500)

and move the perspective clipping plane further out so it doesn't
get clipped out of the picture in the process.

Or set a camera angle very close to, equaling, or exceeding 180 degrees. :)
.



Relevant Pages

  • Re: Draw a circle in OpenGL
    ... (defun draw-circle (radius) ... My purpose is to draw a circle using cl-glfw. ... You are trying to look at a 100 unit radius circle from 5 units away. ...
    (comp.lang.lisp)
  • Re: analytical Skill for Java Development
    ... turtle than with Phytaghoras! ... radius") might be consiedered as "normal" even if it is not said ... I'm not sure what's implicit in an instruction to draw a circle. ...
    (comp.lang.java.programmer)
  • Re: (Seemingly) simple geometry problem
    ... Draw three radii to ... perimeter, ... equal to the radius of the circle. ...
    (sci.math)
  • Re: Id never seen this before
    ... radius, the other, earth radius plus tower height. ... the geometric distance from tower top to earth horizon. ... Draw a radial line from the center to the circle. ...
    (rec.aviation.piloting)
  • Re: Simple Geometry Problem
    ... the same circle of length 10 units, find the radius of the circle. ... Draw a radii at either end of the arc. ... Draw the radius that bisects this angle. ...
    (sci.math)