Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (483)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  TexCoordGeneration planes  (Read 2153 times)
0 Members and 1 Guest are viewing this topic.
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Posted 2005-05-24 16:29:30 »

I'm having trouble getting the planes in TexCoordGeneration to have an effect on the actual texture coordinate generation.  I am generating 2D tex coords for a sphere, and have tried many combination of S and T planes, but the resulting tex coords do not seem to vary as a function of the planes.  Has anyone else had a similar experience?  I don't see any problems in the JOGL code...
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2005-05-25 10:33:50 »

Out of curiosity, why not just use the GeoSphere (or Sphere) primitives (passing in GeometryArray.TEXTURE_COORDINATE_2)?

I believe that generates quite good texture coordinates.

Regarding your actual question, I'm afraid I havn't used it so I'm not much help.  Hopefully someone else might be able to shed some light if the alternative solution is no good.

Cheers,

Will.

Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #2 - Posted 2005-05-26 14:31:46 »

The Sphere was just an example.  I can generate texture coordinates for an arbitrary object just fine.  In general, I want to change the orientation of a texture relative to an object (which wouldn't really matter for a Sphere anyway).  I just realized that I can use the texture transform.  I'll try that Smiley  It is curious that changing the tex coord generation planes doesn't seem to have any effect though.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2005-05-29 03:07:18 »

Is this problem relating to the bug Matthais reported in Issue 91?

Will.

Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #4 - Posted 2005-06-02 22:43:06 »

Yes!  I just updated from CVS and can now adjust the tex coord generation planes!  Thanks Will and Matthais!
Offline tiomemo

Innocent Bystander





« Reply #5 - Posted 2006-07-23 17:23:30 »

I'm having a similar problem with TexCoordGeneration.

How can I download the patch you were talking about?

And about this topic I have another question :

is there any way to normalize the vertex mapped coordinates between 0 and 1?

bye!
Offline cylab

JGO Ninja


Medals: 43



« Reply #6 - Posted 2006-09-28 21:17:32 »

I just hit the same problem: the bug reappeared in the JSR renderer. I just copied the fixes over from the lwjgl renderer.

Here is the patch:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
89c89,90
<    
---
>
>     private FloatBuffer tmpPlaneBuffer = BufferUtil.newFloatBuffer(4);
154c155,162
<    
---
>
>     private void copyPlaneToFloatBuffer(FloatBuffer planeBuf, Vector4f plane) {
>         planeBuf.put(plane.x);
>         planeBuf.put(plane.y);
>         planeBuf.put(plane.z);
>         planeBuf.put(plane.w);
>         planeBuf.flip();
>     }
157,158c165,166
<         //float[] plane = null;
<         FloatBuffer planeBuffer = null;
---
>         int glPlaneName = GL.GL_EYE_PLANE;
>         FloatBuffer planeBuf = null;
162,163c170,171
<                 //plane = new float[4];
<                 planeBuffer = BufferUtil.newFloatBuffer(4);
---
>                 glPlaneName = GL.GL_OBJECT_PLANE;
>                 planeBuf = tmpPlaneBuffer;
167,168c175,176
<                 //plane = new float[4];
<                 planeBuffer = BufferUtil.newFloatBuffer(4);
---
>                 glPlaneName = GL.GL_EYE_PLANE;
>                 planeBuf = tmpPlaneBuffer;
180c188
<      
---
>
188,196c196,198
<               if (planeBuffer != null) {
<                   Vector4f plane = texGen.getPlaneS();
<                   planeBuffer.put(plane.x);
<                   planeBuffer.put(plane.y);
<                   planeBuffer.put(plane.z);
<                   planeBuffer.put(plane.w);
<                   planeBuffer.rewind();
<                   //texGen.getPlaneS().get(plane);
<                   gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
---
>               if (planeBuf != null) {
>                   copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                   gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
198d199
<              
207,221c208,213
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
223c215
<                
---
>
233,256c225,233
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneR();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_R, glGenMode, planeBuffer);
<                    //texGen.getPlaneR().get(plane);
<                    //  gl.glTexGenfv(GL.GL_R, glGenMode, plane);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneR());
>                     gl.glTexGenfv(GL.GL_R, glPlaneName, planeBuf);
258d234
<                
269,297c245,256
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneR();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_R, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneQ();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_Q, glGenMode, planeBuffer);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneR());
>                     gl.glTexGenfv(GL.GL_R, glPlaneName, planeBuf);
>
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneQ());
>                     gl.glTexGenfv(GL.GL_Q, glPlaneName, planeBuf);


@Marvin, @Amos, @Will
You have to incorporate this patch, since I don't have write access.
However, do you have any objections to grant CVS write access to me? Only for fixing bugs like this while toying around with the Terrain code.

Mathias

Mathias - I Know What [you] Did Last Summer!
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #7 - Posted 2006-09-28 23:54:39 »

I guess you tried it out, did you? Since jogl doesn't work with float buffers but with floats, I suspect it won't work this way.

Is is the CanvasPeerImpl file you're talking about?

@Marvin, @Amos, @Will
You have to incorporate this patch, since I don't have write access.
However, do you have any objections to grant CVS write access to me? Only for fixing bugs like this while toying around with the Terrain code.

Since this is a core related fix, you'll have to wait for Will, to ask him for dev-role-granting. Or you can jaut mail him. Do you have his mail address? (the one in his profile is incorrect). Even if I wouldn't object, I don't have a vote as long has we still stay on dev.java.net Sad.

Marvin
Offline cylab

JGO Ninja


Medals: 43



« Reply #8 - Posted 2006-09-29 06:34:00 »

I guess you tried it out, did you?
Sure  Cool

Since jogl doesn't work with float buffers but with floats, I suspect it won't work this way.
Where do you get that from? Buffers just work fine in the JSR version, but you have to rewind or flip the buffer before passing it to JOGL.

Is is the CanvasPeerImpl file you're talking about?
Sorry for forgetting that. It's ShapeAtomPeer.

@Marvin, @Amos, @Will
You have to incorporate this patch, since I don't have write access.
However, do you have any objections to grant CVS write access to me? Only for fixing bugs like this while toying around with the Terrain code.

Since this is a core related fix, you'll have to wait for Will, to ask him for dev-role-granting. Or you can jaut mail him. Do you have his mail address? (the one in his profile is incorrect). Even if I wouldn't object, I don't have a vote as long has we still stay on dev.java.net Sad.
Ok, I will write WIll a PM and have to wait...

Mathias - I Know What [you] Did Last Summer!
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #9 - Posted 2006-09-29 14:38:03 »

Be it blessed, the day we're on sourceforge. Then we could grant you fifty times the core CVS access, if you wanted to  Grin Grin Grin

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (15 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (38 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!