View Full Version : Code doesn't display image
08-18-2009, 11:39 PM
I couldn't get drawEpicycloid to work hence I plonked in two other functions, drawTriangle(), and drawOval() to see whether other functions could work or not but I still could not extrapolate what was wrong. drawTriangle() seems to work but still not drawOval() and drawEpicycloid.
Any ideas what might be wrong?
08-19-2009, 08:21 AM
alot can be wrong. f.e. if your background is black and your points too you won't see a difference. also give your points proper Z values via glVertex3f like on the triangle. don't see how you swap buffers actually but since you say you see a triangle then ok (maybe GLUT auto).
08-19-2009, 08:47 AM
_NK47: There's only a single buffer, so there's no need to swap.
First, the standard C sin and cos functions take radians, so you need to change your loops from 0-360 to 0-2pi in the oval function, but I think you got it in the Epicycloid.
Also, you have an othographic volume in the init function, but on reshape it changes to perspective; you probably want that to be consistent.
The problem is the depth of the vertices. The viewing volume is from 0.5 to 20 deep, and coordinates specified using glVertex2f are at 0, so you need to either translate the points or use glVertex3f.
You have the clippling planes noted in the your comments, and you specified the depth of the vertices of the triangle, so it seems that you were already onto it.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.