texture map stretches funnily when rotating

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

texture map stretches funnily when rotating

Postby dolgion1 » Fri Apr 03, 2009 5:54 am

Hi there,

I started learning OpenGL ES for Android and i slightly modified the Graphics API example from the SDK
"Textured Triangle".
I turned the shape into a rectangle made of a triangle strip and put the texture upon it.
Now what I don't get are two things:

1. the texture coordinates are not what I think they theoretically should be. As far as I understand it,
the coordinates for the lower left, lower right, upper left and upper right corners should be (0,0), (1,0), (0,1), (1,1) respectively.
A texture coordinate asigns a coordinate on the texture to the corresponding coordinate (vertex) on the polygon, doesn't it?
But here in my example, I ended up with these texture coordinates (by trial and error): (0,0),(-1,0),(0,-1),(-1,-1).
In other words, I have to multiply the coords I originally thought correct by -1. If I don't, the texture is applied upside-down.

2. When I rotate the rectangle along the y axis, the texture somehow 'wobbles' in the centre of the rectangle.

I'll attach the project and I'd be reeaally grateful if somebody more knowledgeable in this matter can enlighten me.
THX
Attachments
Triangle.zip
(137.57 KiB) Downloaded 196 times
dolgion1
Freshman
Freshman
 
Posts: 2
Joined: Fri Apr 03, 2009 5:33 am

Top

RE:

Postby dohuon » Wed Apr 15, 2009 2:51 am

1. See opengl tutorials

2. I strugged with same problem for a week until I realized it is working perfectly on Android device. :shock:
Not only this problem, I felt emulator has lots of problem on drawing opengl.
dohuon
Freshman
Freshman
 
Posts: 3
Joined: Tue Mar 31, 2009 3:43 am

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests