View Full Version : How to draw a 2D circle?

jyoung77

01-21-2005, 01:22 PM

Hi,

Can someone tell me how to draw a 2D circle that will always face you no matter how you rotate the model? Please help. Thanks.

Tony

I'd try drawing the circle in Orthographic projection (GL_PROJECTION) mode first, then switch to perspective projection mode (GL_MODELVIEW) to draw the model.

Here\'s an example from NeHe\'s tutorials... (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=21)

forth

01-24-2005, 01:54 AM

Changing projections may work, but there is a better way. If you want your circle to be shown as a part of the model (same position and size, but different orientetion) do next.

First you sould render the model (whatever projection you use) and obtain the coordinates of the center of the circle (using gluProject, for exmaple). After that you set up the modelview matrix to translate the model to the obtained coordinates WITHOUT the rotation of the model and simply render your circle.

This will work is you use modelview matrix to change the position of the model, and projection only to project, not to rotate (the projection matrix is often used as the camera's matrix, if you want to use this kind of matrix, than you should keep it separatly and multiply the modelview matrix by it before rendering).

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.