Re: Draw a circle in OpenGL
- From: Bill McCleary <mccleary.b@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 25 Aug 2009 23:27:54 -0400
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. :)
.
- References:
- Draw a circle in OpenGL
- From: Elvis Nguyen
- Re: Draw a circle in OpenGL
- From: Barry Fishman
- Draw a circle in OpenGL
- Prev by Date: Re: Global variables done right
- Next by Date: Re: Global variables done right
- Previous by thread: Re: Draw a circle in OpenGL
- Next by thread: Re: Draw a circle in OpenGL
- Index(es):
Relevant Pages
|