Hi Gavin,
You left out a couple of bits. The first two vertices have to be calculated with Cos and Sin just like all the others. Also the second line of the inner loop that adds the two next vertices, you had nexty2,nexty2 instead of nextx2,nexty2.
The following works:
I've assumed that your inner radius is 2 and your outer radius is 2.5, but you can adjust that. If you do, make sure you adjust it for the first two vertices also.
The next thing you need to do is texture it. For this you need a few things. You have to have a texture uploaded (see glTexImage2D). You have to enable texturing with glEnable(GL_TEXTURE_2D). You have to bind (select) the current texture with glBindTexture(). Then you have to specify texture coordinates *before* each vertex that you define. As mentioned previously, you'll have to think about whether you plan to share sets of vertices in a strip or have separate GL_QUADS. With the strip the next pair of corners are shared with the previous pair so your texture image has to be a horizontal strip and as you go through the loop you have to increment the texture coordinates to move across the image to the next segment. I recommend putting all images needed into a single composite image like as an anim strip otherwise you'll have to glBindImage() for every quad you draw, which is an overhead.
You left out a couple of bits. The first two vertices have to be calculated with Cos and Sin just like all the others. Also the second line of the inner loop that adds the two next vertices, you had nexty2,nexty2 instead of nextx2,nexty2.
The following works:
SuperStrict SetGraphicsDriver GLGraphicsDriver() GLGraphics 640,480 glViewport(0,0,640,480) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0,640.0/480,0.1,100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() Global Angle:Float=0 Global Quads:Int=16 Global AngleStep:Float=360.0/Quads Repeat Angle=0 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() glTranslatef(0,0.0,-6.0) glBegin(GL_QUAD_STRIP) glColor4f(0.0,0.0,1.0,1.0) glVertex2f(2*Cos(Angle),2*Sin(Angle)) glVertex2f(2.5*Cos(Angle),2.5*Sin(Angle)) For Local x:Int=0 To 15 Angle:+AngleStep glVertex2f(2*Cos(Angle),2*Sin(Angle)) glVertex2f(2.5*Cos(Angle),2.5*Sin(Angle)) Next glEnd() Flip() Until KeyDown(key_escape)
I've assumed that your inner radius is 2 and your outer radius is 2.5, but you can adjust that. If you do, make sure you adjust it for the first two vertices also.
The next thing you need to do is texture it. For this you need a few things. You have to have a texture uploaded (see glTexImage2D). You have to enable texturing with glEnable(GL_TEXTURE_2D). You have to bind (select) the current texture with glBindTexture(). Then you have to specify texture coordinates *before* each vertex that you define. As mentioned previously, you'll have to think about whether you plan to share sets of vertices in a strip or have separate GL_QUADS. With the strip the next pair of corners are shared with the previous pair so your texture image has to be a horizontal strip and as you go through the loop you have to increment the texture coordinates to move across the image to the next segment. I recommend putting all images needed into a single composite image like as an anim strip otherwise you'll have to glBindImage() for every quad you draw, which is an overhead.