Hey all,
tried the above codes supplied which i have got working and textured, the problem i have is with the textures. the textures come out...well kinda distorted:

code:
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)
glEnable(GL_TEXTURE_2D)
glLoadIdentity()
Global Angle:Float=0
Global Quads:Int=16
Global AngleStep:Float=360.0/Quads
Global DiscAngle:Float=0
Global tileTexture:TPixmap=LoadPixmap("1.png");Global TileTex%;Global txPos:Float;
TileTex = GLTexFromPixmap(tileTexture,True)
Repeat
Angle=0
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glTranslatef(0,0.0,-5.0)
glRotatef(-60,1,0,0)
glBindTexture(GL_TEXTURE_2D,TileTex)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT)
'glRotatef(DiscAngle,0,0,1)
glBegin(GL_QUAD_STRIP)
glTexCoord2f(0.0,0.0);
glVertex2f(1.5*Cos(Angle),1.5*Sin(Angle))
glTexCoord2f(0,1);
glVertex2f(2.5*Cos(Angle),2.5*Sin(Angle))
txPos=1;
For Local x:Int=0 To Quads-1
Angle:+AngleStep
glTexCoord2f(0,txPos);
glVertex2f(1.5*Cos(Angle),1.5*Sin(Angle))
glTexCoord2f(1,txPos);
glVertex2f(2.5*Cos(Angle),2.5*Sin(Angle))
If txPos = 1 Then
txPos = 0
Else
txPos=1
EndIf
Next
glEnd()
If KeyDown(KEY_R)
DiscAngle:+2
EndIf
Flip()
Until KeyDown(key_escape)
also get same issue with:
SuperStrict
SetGraphicsDriver GLGraphicsDriver()
GLGraphics 800,600
Global tileTexture:TPixmap=LoadPixmap("1.png");Global TileTex%=GLTexFromPixmap(tileTexture);Global txPos:Float;
glViewport(0,0,800,600);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,800.0/600,0.1,100.0);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D)
glLoadIdentity();
Local Ring:TRing = TRing.Create(0 , 0 , 1 , 0.5 , 18)
Repeat
' angle=0;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glTranslatef(0,0,-4);
glBindTexture(GL_TEXTURE_2D,TileTex)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT)
glBegin(GL_QUADS);
Ring.Draw()
glEnd();
Flip()
Until KeyDown(key_escape)
Type TQuad
Field Points:Float[8]
Function Create:TQuad(x1:Float , y1:Float , x2:Float , y2:Float , x3:Float , y3:Float , x4:Float , y4:Float)
Local Q:TQuad = New TQuaD
Q.Points = [x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4]
Return Q
End Function
Method Draw()
DrawPoly(Points)
End Method
Method Render()
glTexCoord2f(0,0);glvertex2f(Points[0], Points[1])
glTexCoord2f(1,0);glvertex2f(Points[2], Points[3])
glTexCoord2f(1,1);glvertex2f(Points[4], Points[5])
glTexCoord2f(0,1);glvertex2f(Points[6] , Points[7])
End Method
End Type
Type TRing
Field Segments:TList = New TList
Function Create:TRing(X:Float , Y:Float, inner:Float,thickness:Float,seg:Int = 32)
Local R:TRing = New TRing
Local Stepper:Float = 360.0/seg
Local Angle:Float = 0
Repeat
Local x1:Float
Local x2:Float
Local x3:Float
Local x4:Float
Local y1:Float
Local y2:Float
Local y3:Float
Local y4:Float
x1 = X + Sin(Angle) * inner
y1 = Y - Cos(Angle) * inner
x4 = X + Sin(Angle) * (inner + thickness)
y4 = Y - Cos(Angle) * (inner + thickness)
angle:+ Stepper
x2 = X + Sin(Angle) * inner
y2 = Y - Cos(Angle) * inner
x3 = X + Sin(Angle) * (inner + thickness)
y3 = Y - Cos(Angle) * (inner + thickness)
R.Segments.Addlast(TQuad.Create(x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4) )
Until Angle >= 360
Return R
End Function
Method Draw()
For Local Q:TQuad = EachIn segments
glPolygonMode(GL_FRONT,GL_LINE)
Q.Render()
glPolygonMode(GL_FRONT,GL_FILL)
Next
End Method
End Type
it seems to be where the quad is made of tri's and the join of the tri's is what is causing the issue, but i cant seem to find a way around it?
any hints :)