Sweet!
On Sun, Mar 22, 2009 at 12:11 PM, Dave Griffiths <[email protected]> wrote: > Hi Scott, > > Got it! I think it's the png texture loading code. The data from libpng > seems to come in flipped compared to how opengl expects. I've fixed this > in git and put the texture coords back to how they were for planes and > cubes. > > This had resulted in problems in the past importing models with > textures, but I just flipped the texture in gimp and had completely > forgotten about it. > > cheers, > > dave > > On Sun, 2009-03-22 at 09:33 -0700, Scott wrote: >> And I just checked - build-plane makes things that look right, but >> they assume that textures are "upside down" too... >> >> (pdump p1) >> 0: P: -0.500 -0.500 0.000 T: 0.000 1.000 0.000 >> 1: P: 0.500 -0.500 0.000 T: 1.000 1.000 0.000 >> 2: P: 0.500 0.500 0.000 T: 1.000 0.000 0.000 >> 3: P: -0.500 0.500 0.000 T: 0.000 0.000 0.000 >> 4: P: -0.500 0.500 0.000 T: 1.000 0.000 0.000 >> 5: P: 0.500 0.500 0.000 T: 0.000 0.000 0.000 >> 6: P: 0.500 -0.500 0.000 T: 0.000 1.000 0.000 >> 7: P: -0.500 -0.500 0.000 T: 1.000 1.000 0.000 >> >> Do I have the convention wrong? >> >> On Sun, Mar 22, 2009 at 9:08 AM, Scott <[email protected]> wrote: >> > Hmm... I picked up the commits and rebuilt, but I'm still seeing the >> > texture coords flipped. >> > >> > Here's how I'm testing. The quad on the right is built assuming that >> > S,T of [0,0] is in the lower left and [1,1] is in the upper right (aka >> > 1st quadrant), and I'm pretty sure the OpenGL convention. The quad on >> > the left assumes that [0,0] is in the upper left corner and [1,1] is >> > in the lower right. >> > >> > (define (build-quad uv-quadrant1) >> > (let ([quad (build-polygons 4 'quad-list)]) >> > (with-primitive quad >> > (if uv-quadrant1 >> > (begin >> > ;; assumes s,t coordinates are 1rst quadrant >> > (pdata-set! "p" 3 (vector 0 0 0)) >> > (pdata-set! "t" 3 (vector 0 0 0)) >> > (pdata-set! "p" 2 (vector 0 1 0)) >> > (pdata-set! "t" 2 (vector 0 1 0)) >> > (pdata-set! "p" 1 (vector 1 1 0)) >> > (pdata-set! "t" 1 (vector 1 1 0)) >> > (pdata-set! "p" 0 (vector 1 0 0)) >> > (pdata-set! "t" 0 (vector 1 0 0)) >> > ) >> > (begin >> > ;; assume s,t coordinates are 4th quad >> > (pdata-set! "p" 0 #( 1 0 0)) >> > (pdata-set! "t" 0 #( 1 1 0)) >> > (pdata-set! "p" 1 #( 1 1 0)) >> > (pdata-set! "t" 1 #( 1 0 0)) >> > (pdata-set! "p" 2 #( 0 1 0)) >> > (pdata-set! "t" 2 #( 0 0 0)) >> > (pdata-set! "p" 3 #( 0 0 0)) >> > (pdata-set! "t" 3 #( 0 1 0)) >> > )) >> > (recalc-normals quad) >> > ) >> > quad)) >> > ;; assumes 1st quad and looks wrong :( >> > (define quad-q1 (build-quad #t)) >> > (grab quad-q1) >> > (translate (vector 1 0 0)) >> > (scale 5) >> > (hint-wire) >> > (texture (load-texture "textures/flower.png")) >> > >> > ;; assumes 4th quad and looks right >> > (define quad-q4 (build-quad #f)) >> > (grab quad-q4) >> > (translate (vector -5 0 0)) >> > (scale 5) >> > (hint-wire) >> > (texture (load-texture "textures/flower.png")) >> > >> > >> > >> > On Sat, Mar 21, 2009 at 3:05 PM, Dave Griffiths <[email protected]> wrote: >> >> Hi all, >> >> >> >> I've fixed the planes, texture coords and flipped y rotation. >> >> >> >> If you update, existing scripts may change behaviour, so consider >> >> yourself warned :) >> >> >> >> Part of this was fixing the knots on the nurbs plane, so now the surface >> >> extends up to the control vertices rather than slightly inside. All the >> >> planes (build-plane, build-seg-plane and build-nurbs-plane) should all >> >> be coincident now. >> >> >> >> Scott, if you could check that things are ok, that would be good. >> >> >> >> I think I'll need to fix some of the example scripts too... >> >> >> >> cheers, >> >> >> >> dave >> >> >> >> >> > > >
