From: <phi...@ya...> - 2003-04-30 14:49:25
|
hello, I need to get back the coordinates of the polygons I have tesselated (with your help, thank you). So I use the glRenderMode(GL_FEEDBACK). I've experienced two problems: I draw: if(mode == GL_FEEDBACK) gl.glPassThrough(1.0f); gl.glBegin(GL_POINTS); gl.glVertex3f(1f, 1f, 1f); gl.glEnd(); gl.glBegin(GL_POLYGON); gl.glVertex3f(0.0f, 0.0f, 0.0f); gl.glVertex3f(0.0f, 3.0f, 0.0f); gl.glVertex3f(4.0f, 3.0f, 0.0f); gl.glVertex3f(6.0f, 1.5f, 0.0f); gl.glVertex3f(4.0f, 0.0f, 0.0f); gl.glEnd(); then I parse the feedbackBuffer: (with: gl.glFeedbackBuffer(60, GL_3D, feedBuffer);) void printBuffer(int size, float[] buffer) { int count; float token; count = size; System.out.println(" ***********start*************"); while(count != 0) { token = buffer[size - count]; count--; if(token == gl.GL_PASS_THROUGH_TOKEN) { System.out.println("FLAG " + gl.GL_PASS_THROUGH_TOKEN + " " + buffer[size - count]); count--; } else if(token == gl.GL_POINT_TOKEN) { System.out.println("POINT " + gl.GL_POINT_TOKEN); count = print3Dvertex(size, count, buffer); } else if(token == 1799.0f) { System.out.println("FALSE POLYGON " + "1799.0"); count = print3Dvertex(size, count, buffer); count = print3Dvertex(size, count, buffer); } else if(token == GL_POLYGON_TOKEN) { System.out.println("TRUE POLYGON " + gl.GL_POLYGON_TOKEN); float nvertices = buffer[size - count]; count--; for (; nvertices > 0; nvertices--) { print3Dvertex(size, count, buffer); } } else if(token == 1794.0f) { System.out.println("SUMMIT"); count = print3Dvertex(size, count, buffer); count = print3Dvertex(size, count, buffer); } } } Then with "gl.glOrtho(-10.0, 10.0, -10.0, 10.0, 0.0, 100.0);", I get: ***********start************* FLAG 1792 1.0 POINT 1793 i=3 : 288.0 i=4 : 216.0 i=5 : 0.060000002 FALSE POLYGON 1799.0 i=7 : 256.0 i=8 : 192.0 i=9 : 0.06999999 i=10 : 256.0 i=11 : 264.0 i=12 : 0.06999999 SUMMIT i=14 : 256.0 i=15 : 264.0 i=16 : 0.06999999 i=17 : 384.0 i=18 : 264.0 i=19 : 0.06999999 SUMMIT i=21 : 384.0 i=22 : 264.0 i=23 : 0.06999999 i=24 : 448.0 i=25 : 228.0 i=26 : 0.06999999 SUMMIT i=28 : 448.0 i=29 : 228.0 i=30 : 0.06999999 i=31 : 384.0 i=32 : 192.0 i=33 : 0.06999999 SUMMIT i=35 : 384.0 i=36 : 192.0 i=37 : 0.06999999 i=38 : 256.0 i=39 : 192.0 i=40 : 0.06999999 but with: "glu.gluPerspective(45.0f, width / height, 0.1f, 100.0f);", I get: ***********start************* FLAG 1792 1.0 POINT 1793 i=3 : 191.24219 i=4 : 143.4336 i=5 : 0.98431766 FALSE POLYGON 1799.0 i=7 : 99.27344 i=8 : 74.45703 i=9 : 0.986701 i=10 : 99.27344 i=11 : 322.77344 i=12 : 0.986701 SUMMIT i=14 : 99.27344 i=15 : 322.77344 i=16 : 0.986701 i=17 : 540.72656 i=18 : 322.77344 i=19 : 0.986701 SUMMIT i=21 : 540.72656 i=22 : 322.77344 i=23 : 0.986701 i=24 : 639.9961 i=25 : 266.9336 i=26 : 0.986701 SUMMIT i=28 : 639.9961 i=29 : 266.9336 i=30 : 0.986701 i=31 : 639.9961 i=32 : 130.29688 i=33 : 0.986701 SUMMIT i=35 : 639.9961 i=36 : 130.29688 i=37 : 0.986701 i=38 : 540.72656 i=39 : 74.45703 i=40 : 0.986701 SUMMIT i=42 : 540.72656 i=43 : 74.45703 i=44 : 0.986701 i=45 : 99.27344 i=46 : 74.45703 i=47 : 0.986701 As you can see, my first problem is that it doesn't identifies the GL_POLYGON_TOKEN, but each summit of my polygon identified by a "1794.0" value. Why? My second problem is that the returned values don't match with the ones I've entered. I don't understand at all why they should depend on the kind of perspective view (I need the coordinates in the 3D scene). Could you help me? thanks. philippe, student. ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com |