Advertisement

texture rotated wrong

Started by January 01, 2001 04:38 PM
3 comments, last by redmonkey 24 years, 1 month ago
ive been using the nehe''s tutorials as a base for my own code. although now its tottaly my own code (texture hash tables, 999*999 tiled map etc ) but one problem remains, i textured my faces for a cube(the texture-mapped-cube-tutorial code), but the textures have the wrong orientation etc this was fixed on two of the faces by using a negative map (0.0f -> -1.0f etc) but for the other side the texture has the wrong orientation heres a pic from the game of a culprit (sorry its ugly, but you can see its roatetd wrong) http://www.b0mb.co.uk/. now, do i, rotate the whole face, and chnage its dimensions, or is there some other method? purely for the texture orientation? __________________ graham "red" reeves. red@deadpenguin.org www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
are you sure that you have your texture coordinates set right?

HHSDrum@yahoo.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Advertisement
Yeah, like julio said, that only happens when you specify the incorrect texture co-ords.

Im not sure how much experience you''ve had, because i dont want to be repeating something to you that you already know about, but..

Say you have a quad, with co-ords (0,0,0) - Bottom left, (1,0,0) - Bottom right, (1,1,0) - Top right, (0,1,0) - Top left

If you wanted to draw the texture onto the quad the ''right way up'' you would do this:

at vertex (0,0,0) place a texture co-ord of (0,0) {or (0,1) for upside down}
at vertex (1,0,0) place a texture co-ord of (1,0) {or (1,1) for upside down}
at vertex (1,1,0) place a texture co-ord of (1,1) {or (1,0) for upside down}
at vertex (0,1,0) place a texture co-ord of (0,1) {or (0,0) for upside down}

of course, being able to specify your own texture co-ords has many advantages, as you could show only small parts of the actual texture itself, or even create a ''scrolling'' effect..

- wav
ah, the thing is, i didnt think the position of the texture would affect the orientation...

yeah, one of my textures was upside down, but i righted that, but (as the pic shows) the other isnt upside down or back to front, but at 90o to what it should be.

__________________
graham "red" reeves.

red@deadpenguin.org
www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
Whats the difference? You can still set the texture co-ords for that quad to make it appear 'right'.

Or, preferably in the future, make sure you specify the quad's co-ords in a clockwise direction from the bottom left hand corner of the quad.. eg, for a quad to be drawn along the x-axis, follow the (0,0,0) (1,0,0) (1,1,0) (0,1,0) pattern, or for a quad to be drawn along the z-axis, follow the (0,0,1) (0,0,0) (0,1,0) (0,1,1) pattern..

-- wav

'ah, the thing is, i didnt think the position of the texture would affect the orientation...'

Of course the texture co-ordinate positions, at each vertex, affect the orientation of the texture map itself. OpenGL doesnt know which is the right way up..

Edited by - wAVaRiaN on January 2, 2001 8:26:48 AM

This topic is closed to new replies.

Advertisement