Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 4 5 [6] 7
  ignore  |  Print  
  LWJGL BlockWorld  (Read 33681 times)
0 Members and 1 Guest are viewing this topic.
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #150 - Posted 2013-06-21 04:00:27 »

And in my opinion, built worlds always look much nicer than otherwise.

Random generation can sometimes be just as nice as custom-built. Take a look at Delver for example*.

(*If you look around, you may be able to find the old free version. If not, just watch the videos and look at the screenshots.)

Online NegativeZero

JGO Knight


Medals: 42
Projects: 2


Zero but not.


« Reply #151 - Posted 2013-06-21 04:02:52 »

I was more referring to large, outdoor spaces rather than enclosed spaces like that of Delver's.
That said, that does look like a very nice game.
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #152 - Posted 2013-06-21 04:07:34 »

Ah, yes.

Minecraft especially has some fixing to do in procedural generation...

But even then, custom design never beats Simplex/Perlin noise for natural landscape generation.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online NegativeZero

JGO Knight


Medals: 42
Projects: 2


Zero but not.


« Reply #153 - Posted 2013-06-21 04:24:42 »

Well if I was doing by-hand terrain, in my opinion, I would start with noise, and touch up upon that. Shaping a world entirely from scratch would be a completely tedious task, while not yielding the result one would want when making a game, of, as you say, using procedural generation.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #154 - Posted 2013-06-21 19:02:38 »

I think you should use a shader to make the whole world look like the Furnace GUI does right now Smiley


That's a good idea, I would like it to look different. How I would do that I'm not sure, ill take a look at cell shaders, then maybe some vertex noise?

TBH, I've never seen a non-random-gen voxel engine. I think it would be a really cool direction to take, as you could do a lot with it. And in my opinion, built worlds always look much nicer than otherwise.

The landscape is random, I use a diamond start algorithm. But your suggestion is one I'd not considered, and it would Lend itself to small missions?

And in my opinion, built worlds always look much nicer than otherwise.

Random generation can sometimes be just as nice as custom-built. Take a look at Delver for example*.

(*If you look around, you may be able to find the old free version. If not, just watch the videos and look at the screenshots.)

Delver is very interesting, and has a lot in common with my other game. The old free one uses prefabs joined together I believe. Like say-animal crossings!

Making a whole landscape by hand would be a challenge! I'd need to either make a tool to do that, or add tools from within the game, or utilise some minecraft world editing tools and read the format and convert it.

All very interesting. I currently changing the picking to pick faces rather than cubes.
Has anyone ever used the openGL name stack? (Though I thing I will solve the problem geometrically)
Offline Vermeer

JGO Coder


Medals: 16



« Reply #155 - Posted 2013-06-29 19:48:27 »

Update

I have been working on the picking, rather than tracing a in ray increments along the ray and testing block intersection, I have finally decided to ditch this
and do 3 separate axis tests at 1 block intervals, using parametric equations. This is not only 100% accurate, it eliminates problems with corners, and assuming you can pick a block 10
units away on each axis, that is 30 calculations for worst case. Rather than the 100 or so I was doing before for  0.1 unit accuracy.

Now, I'm testing for collision with a face, not a cube! Smiley

I can give details of how this is done if anyone should require a mathematical explanation with code.

<a href="http://www.youtube.com/v/HtjWJiodjhs?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/HtjWJiodjhs?version=3&amp;hl=en_US&amp;start=</a>

Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #156 - Posted 2013-06-29 21:25:50 »

Now, I'm testing for collision with a face, not a cube! Smiley

I can give details of how this is done if anyone should require a mathematical explanation with code.

Despite thinking of that method and posting about it a few months ago, I never manged to implement it properly myself. Sad

I would like to see the code (and the mathematical explanation, so I can see what I missed).

Thanks Smiley

Offline Vermeer

JGO Coder


Medals: 16



« Reply #157 - Posted 2013-06-30 15:15:40 »


Picking faces in 3d - Part 1 - Maths Theory

I'm not sure if this is a standard approach, this is just how I figured it out.

A  ray is traced from the camera position along its direction Vector.

In a voxel world a test can be made at unit intervals on X,Y,Z axis to see if a collision with a
face has occurred. The distance of 3 possible collisions is compared. The closes is the hit face.
(this method can be adapted to work with non-axis aligned boxes too)



This example shows how to use parametric equations to make these tests. These are the equations we will use




This example will be shown in 2d for clarity, but unlike equations of line, this method will work exactly the same in 3d.



 
The camera is located at (1,2.5) has a Vector of (1,-0.25)
That means for each moment of 1 in X, there will be -0.25 movement in Y

We will use the parameter t, which could be visualised as time. After a given time, we will be further along the line. We know where we want to be in x. We are checking all the x planes moving away from the camera in + direction(in this case).

For this example we will be checking x= 6.   So x(t) = 6.
Now we have x(t) we can solve for t.




Now we can calculate the y value y(t) where the line will be on x=6. If the value is >box min and <box max position then the face has been hit.





In 3d the Z and Y values have to be checked, both must be within the in and max bounds of the box for there to be a hit.

We then calculate the distance to that point - in 3d   Distance = Math.sqrt ( X^2, Y^2,Z^2)

Now test all the Z planes, then all the Y planes. The one with the shortest Distance is the one you hit.

Part 2 coming soon - Java code



Offline Vermeer

JGO Coder


Medals: 16



« Reply #158 - Posted 2013-07-03 19:43:50 »

Face Picking part 2 - Java Code

This is my cumbersome implementation. Its not optimised, or well coded, but it should be clear how it works.

The update loop gets the camera vector....using the horizontal rotation (rot) and vertical rotation (lookupdown) angles in degrees
1  
2  
3  
4  
5  
6  
7  
public void getNormalisedCamVector(){
         camVector.y =  (float) Math.sin(lookupdown * piover180) * 1f;
         float v = (float) Math.cos(lookupdown * piover180) * 1f;
         camVector.x = (float) Math.sin(yrot * piover180) * v;
         camVector.z= (float) Math.cos(yrot * piover180) * v;
         
      }



Next a test is done in X, if facing right x>0.... so
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  
      //do right X sweep
         if(camVector.x>0){
           
            for(int distance=1;distance<10;distance++){
            //solve for t
            t =   (((int)xpos -( distance+0.5f) )-xpos) / camVector.x;
            Xh = (int)xpos -(distance + 1);
           
            //solve for Yh
            Yh = -camHieght + t*camVector.y;
            Zh = zpos + t  * camVector.z;
            Xd = xpos - Xh;
            Yd = Math.abs(-camHieght - Yh);
            Zd =Math.abs(zpos - Zh);
           
           
            Yh = (int) (Yh+0.5f);
            Zh = (int)( Zh+0.5f);
            helperX=Xh;
            helperY=Yh;
            helperZ=Zh;
            //System.out.println("Xh="+Xh+ "   Yh="+ Yh +  "  Zh=" + Zh);
            if(isHelperOnSoildBlock()){
               helperFace = 5;
               
               XDist = (float)Math.sqrt(Xd*Xd + Yd* Yd + Zd*Zd);
               xx = Xh; xy = Yh; xz = Zh;
               //System.out.println("XDist =" + XDist );
               break;
            }
            }
           
         }


some floats are used to hold temp values. The isHelperOnSoildBlock method uses the helperBlock position and returns true if the block is soild (not water or air).
The distance is saved.

Y and Z axis tests are just the same. (as well as facing left x<=0)

After all the tests:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
if (XDist < ZDist && XDist < YDist){
         
            if(camVector.x>0){
            helperFace = 5;  
            }else{
            helperFace = 4;  
            }
           
           
            Xh = xx; Yh = xy; Zh=xz;
         }


In this example if the X distance was the shortest, the faces and block position are saved. The blocks render method will only render the
face with that helperFace ID.

one thing to note:
when a block is removed , its the block at Xh, Yh, Zh

but if a block is added
then if HelperFace =4, then Xh-=1 just before the block is placed.
So we use the helperface ID to determine how the selected face alters where we place a block - but not where a block is removed.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #159 - Posted 2013-07-18 09:39:47 »

Update

Added a 3d cloud. Modelled and textured in blender, and exported as .OBJ. 
I have a also made a new animated water texture, and pass co-ordinates to the shader.

<a href="http://www.youtube.com/v/fFeFzTAbHgo?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/fFeFzTAbHgo?version=3&amp;hl=en_US&amp;start=</a>
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline puffadder

Innocent Bystander





« Reply #160 - Posted 2013-07-21 06:20:47 »

Oh this is so inspiring, it looks beautiful, just for this I'm greatly inspired to learn java and enrole myself in a CS course.
Where can we play it? Is there any chance you show how goes your code so we all can learn from this good work too? Thank you keep the good work!
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #161 - Posted 2013-07-21 15:31:46 »

The project is coming along nicely, but that inventory popup/screen seems really clumsy to me, like it's always blocking your view of the block hand. Obviously I saw the "x" button, but I think it would be a lot better to put the inventory somewhere less-intrusive.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #162 - Posted 2013-07-21 19:38:55 »

Where can we play it? Is there any chance you show how goes your code so we all can learn from this good work too? Thank you keep the good work!

I will compile a runnable version, and also update the source code for download. I've cleaned the code up a bit and annotated some of it. Thank you for taking an interests, I'm doing this project to learn various things.

The project is coming along nicely, but that inventory popup/screen seems really clumsy to me, like it's always blocking your view of the block hand. Obviously I saw the "x" button, but I think it would be a lot better to put the inventory somewhere less-intrusive.

Yes, I see what you mean. I plan for the windows to be moveable, drag with mouse. I've got a a map window to put in, I might put the Inventory under that. Thank you for your suggestion, I'll change that for the next update.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #163 - Posted 2013-08-19 18:48:32 »

Have been busy lately with other things - I'm not sure at this point if I will work on this again, maybe - may be not.
Working on a small app atm..

Anyhow...I have uploaded the source code to my site:
http://borderterrierart.weebly.com/programming.html

Please feel free to use any of it. Its not perfect, or even good, but you might be able to use some of it if your learning LWJGL - especially to make a
block game.

I'll still be around on forum so ask questions if you need to...
Offline AullenVerch

Senior Newbie




The univertse is vast!!


« Reply #164 - Posted 2013-12-13 06:35:55 »

I have been lurking here for a couple of weeks reading on the progress you had made. Thank you for sharing all the source Vermeer!! I can't wait to look at it.  Smiley
Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #165 - Posted 2013-12-27 10:20:53 »

Hello i need some help with this.first of all maybe someone can explain how that tool is drawed?i looked on its code and played a litle bit but i cant figure out how to change that metal sides shape.for example hot to draw an axe.I have made stick but i am missing the metal part.
And my other question is how do i can enable infinite terrain back? And yea i am yust learning all this.Son i will make my own engine but at the beginig i want to understand how this code works.Thanks.
Offline Longarmx
« Reply #166 - Posted 2013-12-27 16:14:26 »

Enable infinite terrain? You have to generate the terrain yourself, per chunk, using an algorithm that you've implemented.

Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #167 - Posted 2013-12-27 16:43:57 »

DreamHacker start at the basics. It sounds like you don't know much about OpenGL yet because your first question is almost trivial to solve. What you need to understand is that no one will code your entire game for you, and if you think that's going to happen then you need to revisit the basics of programming where people learn to be independent. You need to be a problem solver.

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #168 - Posted 2013-12-27 21:36:07 »

Yea in openGl i dont have muck expiriance.But i am learning.And i dont ask somebody to code the whole game for me.I only ask to tell or guid how to start doing things on my own.

But i think i will start with 2d game in which i will need some help too.And i wana ask is here in this forum anyone who can help me when i will ask for help?I dont ask code only examples how i can do it Smiley
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #169 - Posted 2013-12-28 14:36:17 »

What you don't realize is that you're asking for huge amounts of help/code, and you really need to figure it out by yourself by researching a lot and testing out your ideas.

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #170 - Posted 2013-12-28 15:48:29 »

i know i am asking alot but what i ask i alredy in source code so basicly i ask to explain how do i inplement my own thing in code which i alredy have?For example i want to add one new tool.I only need explanation on how to make it ater that i can lots of new tools by my self and make other new things.So what you suggest me?
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #171 - Posted 2013-12-28 18:49:26 »

I suggest you come up with a solution. Be a problem solver.

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #172 - Posted 2013-12-28 19:01:22 »

its hard to solve problem when you dont know how to.As i said i dont ask for code only for explaining the code which i have.
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #173 - Posted 2013-12-28 19:06:22 »

No problem is unsolvable unless you let it be. Other people have done it before, I don't think you have anything stopping you, so why not try to figure it out? Sit down with a notebook and write down all your ideas, and then come to your best solution and try it out. I can guarantee you'll learn something that will help you, even if it doesn't solve your original problem. That's what I do when I need to figure something out.

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #174 - Posted 2013-12-28 19:38:37 »

okay i understand your point but i think you realy dont understand my problem.
And yea forgot about infinite terain i need to learn more about java to do that.
But for now i need to understand how to axe which curently are in game is drawed in.I have alredy played with the code and i know what i want to draw i even have a plan about what i want in my game but i actualy dont know how to realise my shity problem with tools.I know how to make new blocks in game.how to add new sound to new actions how to add new guis and stuff like that but i want to make new tools.
I can give you code with my axe(not realy mine becaus i didnt code it)  but yeah i have it and if you could comment out some lines about what they do so i could make my own code with my own tool in it.
And if you can help me with advise add me to your skype (chosen1312) and maybe you could help one dude out.i bet you have been in situation like mine when you actualy dont know what to do but you real want to it.

P.S sorry for my bad english if it is bad Cheesy
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #175 - Posted 2013-12-28 19:40:40 »

Explain to me exactly what your problem is, and maybe I can help you. Are you having trouble rendering your items?

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #176 - Posted 2013-12-28 20:49:11 »

okay i will try.
So for now only thing whats not working is transperasy for glass and leaves but thats diferent story i dont know whay that is.
Anyway my problem is that i have my axe script which Vermeer has well writen and it works okay but now i want to add my won tool to objects package so i added pickaxe which will eventualy be an axe for wood choping. So all what i want from you is to excplain me how orginal axe (which looks like pick axe) is writen litle explanations on how its rendered nly with comments in code.

So here is code.I dont want you to add more code to it or something else just explain me what is what in it so i can make my own tool.
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  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
package objects;

import java.nio.FloatBuffer;

import org.lwjgl.opengl.GL11;

public class Axe {

   public static void VertexData(FloatBuffer vHandle,float  xOset, float yOset, float zOset,float tint){
     
      float side = 0.15f;
      float side2 = 0.3f;
      float s= 0.0625f; //texture size 1/16
      float h = s*0;
      //front face
            //quad 1 bottom
           
            vHandle.put(-0.5f + xOset).put(-0.5f + yOset).put(+0.5f + zOset); // vertex bottom left
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h).put(s); // texture
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // v  bottom right
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h+s).put(s); //    t
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v top right
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h+s).put(0); // t
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v top left
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h).put(0); //t
           
           
            // right face
            // triangle 1 bottom
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // v
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h).put(s); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h+s).put(s); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h+s).put(0); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h).put(0); //

            //back face
            //triangle 1 bottom
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // vertex
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h).put(s); // texture
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(-0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
            vHandle.put(h+s).put(s); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h+s).put(0); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint-side).put(tint-side).put(tint-side);
            vHandle.put(h).put(0); // c   blue
           
         
            //top face
            //triangle 1 bottom
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // vertex
            vHandle.put(tint).put(tint).put(tint);
            vHandle.put(h).put(s); // texture
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v
            vHandle.put(tint).put(tint).put(tint);
            vHandle.put(h+s).put(s); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(+0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint).put(tint).put(tint);
            vHandle.put(h+s).put(0); //
            //vHandle.put(tint).put(tint).put(tint);
            vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
            vHandle.put(tint).put(tint).put(tint);
            vHandle.put(h).put(0); // c   blue
           
           
            // left face
               // triangle 1 bottom
            //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // v
               vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
               vHandle.put(h).put(s); //
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // v
               vHandle.put(tint-side2).put(tint-side2).put(tint-side2);
               vHandle.put(h+s).put(s); //
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(+0.5f + zOset); // v
               vHandle.put(tint-side).put(tint-side).put(tint-side);
               vHandle.put(h+s).put(0); //
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(+0.5f+ yOset).put(-0.5f + zOset); // v
               vHandle.put(tint-side).put(tint-side).put(tint-side);
               vHandle.put(h).put(0); //
               
               //bottom face
               //triangle 1 bottom
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // v
               vHandle.put(tint).put(tint).put(tint);
               vHandle.put(h).put(s); //
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(+0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // v
               vHandle.put(tint).put(tint).put(tint);
               vHandle.put(h+s).put(s); //
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(-0.5f+ yOset).put(+0.5f + zOset); // vertex
               vHandle.put(tint).put(tint).put(tint);
               vHandle.put(h+s).put(0); // texture
               //vHandle.put(tint).put(tint).put(tint);
               vHandle.put(-0.5f+ xOset).put(-0.5f+ yOset).put(-0.5f + zOset); // v
               vHandle.put(tint).put(tint).put(tint);
               vHandle.put(h).put(0); // c    
               
           
               

      }
   
   public static void RenderVertexColour(int textureID,  float BlockSize){
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);//select texture
      //GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
      //
      float i = 0.5f;
     
      //float side = 0.15f;
      //float side2 = 0.3f;
      float size= 0.0625f; //texture size 1/16
      float Hoffset = size*0f;
      float Voffset = size*0f;
      GL11.glColor3f(0.6f,0.6f, 0.6f);
      //GL11.glColor4d(1,1,1,1);
      GL11.glBegin(GL11.GL_QUADS);
     
     
       Hoffset = size*1f;
       Voffset = size*1f;
      // Top Face  wood
            GL11.glColor3f(1f,1f, 1f);
           
            GL11.glNormal3f(0.0f, i, 0.0f); // Normal Pointing Up
         
            GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(-0.08f, i, -0.05f); // Top Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(-0.08f, i, 0.05f); // Bottom Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(0.08f, i, 0.05f); // Bottom Right Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset + size, Voffset + size);GL11.glVertex3f(0.08f, i, -0.05f); // Top Right Of The Texture and Quad
           
            GL11.glColor3f(0.6f,0.6f, 0.6f);
           
            // Hoffset = size*1f;
             Voffset = size*0f;
            // Top Face  metal right
            GL11.glColor3f(1f,1f, 1f);
           
            GL11.glNormal3f(0.0f, i, 0.0f); // Normal Pointing Up
         
            GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(0.08f, 0.4f, -0.05f); // Top Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(0.08f, 0.4f, 0.05f); // Bottom Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(0.5f, 0.2f, 0.05f); // Bottom Right Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset + size, Voffset + size);GL11.glVertex3f(0.5f, 0.2f, -0.05f); // Top Right Of The Texture and Quad
           
            GL11.glColor3f(0.6f,0.6f, 0.6f);
           
            // Top Face  metal left
            GL11.glColor3f(1f,1f, 1f);
           
            GL11.glNormal3f(0.0f, i, 0.0f); // Normal Pointing Up
         
            GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(-0.5f, 0.2f, -0.05f); // Top Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(-0.5f, 0.2f, 0.05f); // Bottom Left Of The Texture and Quad
         
            GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(-0.08f, 0.4f, 0.05f); // Bottom Right Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset + size, Voffset + size);GL11.glVertex3f(-0.08f, 0.4f, -0.05f); // Top Right Of The Texture and Quad
           
            GL11.glColor3f(0.6f,0.6f, 0.6f);
     
     
      //front of axe
      Hoffset = size*0f;
      Voffset = size*1f;
     
      // Front Face ..............................................................................................
      GL11.glNormal3f(0.0f, 0.0f, i); // Normal Pointing Towards Viewer
     
      //  bottom                x ,   y
      GL11.glTexCoord2f(Hoffset, Voffset + size); GL11.glVertex3f(-0.04f, -i, 0.05f); // Bottom Left Of The Texture and Quad
     
     
     
      GL11.glTexCoord2f(Hoffset + size, Voffset + size );   GL11.glVertex3f(0.04f, -i, 0.05f); // Bottom Right Of The Texture and Quad
     
      //top
      GL11.glTexCoord2f(Hoffset + size,Voffset );GL11.glVertex3f(0.07f, 0.3f, 0.05f); // Top Right Of The Texture and Quad
     
      GL11.glTexCoord2f(Hoffset, Voffset );   GL11.glVertex3f(-0.07f, 0.3f, 0.05f); // Top Left Of The Texture and Quad
     
     
      // Front Face ..............................................................................................
            GL11.glNormal3f(0.0f, 0.0f, i); // Normal Pointing Towards Viewer
           
            //  bottom                x ,   y
            GL11.glTexCoord2f(Hoffset, Voffset + size); GL11.glVertex3f(-0.08f, 0.4f, 0.05f); // Bottom Left Of The Texture and Quad
           
           
           
            GL11.glTexCoord2f(Hoffset + size, Voffset + size );   GL11.glVertex3f(0.08f, 0.4f, 0.05f); // Bottom Right Of The Texture and Quad
           
            //top
            GL11.glTexCoord2f(Hoffset + size,Voffset );GL11.glVertex3f(0.08f, 0.5f, 0.05f); // Top Right Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset, Voffset );   GL11.glVertex3f(-0.08f, 0.5f, 0.05f); // Top Left Of The Texture and Quad
           
            //front of axe
            Hoffset = size*1f;
            Voffset = size*0f;
           
            //metal part
            // Front Face ..............................................................................................
                  GL11.glNormal3f(0.0f, 0.0f, i); // Normal Pointing Towards Viewer
                 
                  //  bottom                x ,   y
                  GL11.glTexCoord2f(Hoffset, Voffset + size); GL11.glVertex3f(-0.07f, 0.3f, 0.05f); // Bottom Left Of The Texture and Quad
                 
                 
                 
                  GL11.glTexCoord2f(Hoffset + size, Voffset + size );   GL11.glVertex3f(0.07f, 0.3f, 0.05f); // Bottom Right Of The Texture and Quad
                 
                  //top
                  GL11.glTexCoord2f(Hoffset + size,Voffset );GL11.glVertex3f(0.08f, 0.4f, 0.05f); // Top Right Of The Texture and Quad
                 
                  GL11.glTexCoord2f(Hoffset, Voffset );   GL11.glVertex3f(-0.08f, 0.4f, 0.05f); // Top Left Of The Texture and Quad
                 
                  //metal part spick left
                  // Front Face ..............................................................................................
                        GL11.glNormal3f(0.0f, 0.0f, i); // Normal Pointing Towards Viewer
                       
                        //  bottom                x ,   y
                        GL11.glTexCoord2f(Hoffset, Voffset + size); GL11.glVertex3f(-0.5f, 0.2f, 0.05f); // Bottom Left Of The Texture and Quad
                       
                       
                       
                        GL11.glTexCoord2f(Hoffset + size, Voffset + size );   GL11.glVertex3f(-0.07f, 0.3f, 0.05f); // Bottom Right Of The Texture and Quad
                       
                        //top
                        GL11.glTexCoord2f(Hoffset + size,Voffset );GL11.glVertex3f(-0.08f, 0.4f, 0.05f); // Top Right Of The Texture and Quad
                       
                        GL11.glTexCoord2f(Hoffset, Voffset );   GL11.glVertex3f(-0.5f, 0.2f, 0.05f); // Top Left Of The Texture and Quad
                       
                        //metal part spick right
                        // Front Face ..............................................................................................
                              GL11.glNormal3f(0.0f, 0.0f, i); // Normal Pointing Towards Viewer
                             
                              //  bottom                x ,   y
                              GL11.glTexCoord2f(Hoffset, Voffset + size); GL11.glVertex3f(0.07f, 0.3f, 0.05f); // Bottom Left Of The Texture and Quad
                             
                             
                             
                              GL11.glTexCoord2f(Hoffset + size, Voffset + size );   GL11.glVertex3f(0.5f, 0.2f, 0.05f); // Bottom Right Of The Texture and Quad
                             
                              //top
                              GL11.glTexCoord2f(Hoffset + size,Voffset );GL11.glVertex3f(0.5f, 0.2f, 0.05f); // Top Right Of The Texture and Quad
                             
                              GL11.glTexCoord2f(Hoffset, Voffset );   GL11.glVertex3f(0.08f, 0.4f, 0.05f); // Top Left Of The Texture and Quad
                                 
           
                              Hoffset = size*0f;
                              Voffset = size*1f;
   
      // Back Face
   //   GL11.glNormal3f(0.0f, 0.0f, -i); // Normal Pointing Away From Viewer
     
      GL11.glTexCoord2f(Hoffset + size,  Voffset + size); GL11.glVertex3f(-0.08f, 0.4f, -0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset  ); GL11.glVertex3f(-0.08f, i, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset  );   GL11.glVertex3f(0.08f, i, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset,  Voffset + size);   GL11.glVertex3f(0.08f, 0.4f, -0.05f); // Bottom Left Of The Texture and Quad
     
     
      GL11.glTexCoord2f(Hoffset + size,  Voffset + size); GL11.glVertex3f(-0.04f, -0.5f, -0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset  ); GL11.glVertex3f(-0.07f, 0.3f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset  );   GL11.glVertex3f(0.07f, 0.3f, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset,  Voffset + size);   GL11.glVertex3f(0.04f,-0.5f, -0.05f); // Bottom Left Of The Texture and Quad
     
      Hoffset = size*1f;
      Voffset = size*0f;
   //metal on back right
      GL11.glTexCoord2f(Hoffset + size,  Voffset + size); GL11.glVertex3f(0.07f, 0.3f, -0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset  ); GL11.glVertex3f(0.08f, 0.4f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset  );   GL11.glVertex3f(0.5f, 0.2f, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset,  Voffset + size);   GL11.glVertex3f(0.5f,0.2f, -0.05f); // Bottom Left Of The Texture and Quad
     
      GL11.glTexCoord2f(Hoffset + size,  Voffset + size); GL11.glVertex3f(-0.07f, 0.3f, -0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset,  Voffset + size);   GL11.glVertex3f(-0.5f,0.2f, -0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset  ); GL11.glVertex3f(-0.08f, 0.4f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset  );   GL11.glVertex3f(-0.5f, 0.2f, -0.05f); // Top Left Of The Texture and Quad
     
      GL11.glTexCoord2f(Hoffset + size,  Voffset + size); GL11.glVertex3f(0.07f, 0.3f, -0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset,  Voffset + size);   GL11.glVertex3f(-0.07f,0.3f, -0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset  ); GL11.glVertex3f(-0.08f, 0.4f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset  );   GL11.glVertex3f(+0.08f, 0.4f, -0.05f); // Top Left Of The Texture and Quad
     
     
     
     
     
      // Bottom Face
   
      Hoffset = size*1f;
      Voffset = size*1f;
   GL11.glNormal3f(0.0f, -i, 0.0f); // Normal Pointing Down
     
     
      GL11.glTexCoord2f(Hoffset + size,Voffset + size); GL11.glVertex3f(-0.04f, -i, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(0.04f, -i, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(0.04f, -i, 0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(-0.04f, -i, 0.05f); // Bottom Right Of The Texture and Quad
     
     
      Hoffset = size*1f;
      Voffset = size*0f;
      GL11.glTexCoord2f(Hoffset + size,Voffset + size); GL11.glVertex3f(-0.5f, 0.2f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(-0.07f, 0.3f, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(-0.07f, 0.3f, 0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(-0.5f, 0.2f, 0.05f); // Bottom Right Of The Texture and Quad
     

      GL11.glTexCoord2f(Hoffset + size,Voffset + size); GL11.glVertex3f(0.07f, 0.3f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(0.5f, 0.2f, -0.05f); // Top Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset);GL11.glVertex3f(0.5f, 0.2f, 0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size, Voffset);   GL11.glVertex3f(0.07f, 0.3f, 0.05f); // Bottom Right Of The Texture and Quad
     
     
   
      // Right face
      Hoffset = size*0f;
      Voffset = size*1f;
      GL11.glNormal3f(i, 0.0f, 0.0f); // Normal Pointing Right
     
      GL11.glTexCoord2f(Hoffset + size, Voffset + size);   GL11.glVertex3f(0.04f, -i, -0.05f); // Bottom Right Of The Texture and Quad
     
      GL11.glTexCoord2f(Hoffset + size, Voffset);GL11.glVertex3f(0.07f, 0.3f, -0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset);   GL11.glVertex3f(0.07f, 0.3f, 0.05f); // Top Left Of The Texture and Quad
     
      GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(0.04f, -i, 0.05f); // Bottom Left Of The Texture and Quad
     
      // Right face top
            Hoffset = size*0f;
            Voffset = size*1f;
            GL11.glNormal3f(i, 0.0f, 0.0f); // Normal Pointing Right
           
            GL11.glTexCoord2f(Hoffset + size, Voffset + size);   GL11.glVertex3f(0.08f, 0.4f, -0.05f); // Bottom Right Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset + size, Voffset);GL11.glVertex3f(0.08f, 0.5f, -0.05f); // Top Right Of The Texture and Quad
            GL11.glTexCoord2f(Hoffset, Voffset);   GL11.glVertex3f(0.08f, 0.5f, 0.05f); // Top Left Of The Texture and Quad
           
            GL11.glTexCoord2f(Hoffset, Voffset + size);   GL11.glVertex3f(0.08f, 0.4f, 0.05f); // Bottom Left Of The Texture and Quad
           
     
     
     
     
      // Left Face
     
      //top
      GL11.glNormal3f(-i, 0.0f, 0.0f); // Normal Pointing Left
     
      GL11.glTexCoord2f(Hoffset,Voffset + size);   GL11.glVertex3f(-0.08f, 0.4f, -0.05f); // Bottom Left Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size,Voffset + size);   GL11.glVertex3f(-0.08f, 0.4f, 0.05f); // Bottom Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset + size,Voffset);GL11.glVertex3f(-0.08f, i, 0.05f); // Top Right Of The Texture and Quad
      GL11.glTexCoord2f(Hoffset, Voffset);   GL11.glVertex3f(-0.08f, i, -0.05f); // Top Left Of The Texture and Quad
     
      // Left Face
     
            //top
            GL11.glNormal3f(-i, 0.0f, 0.0f); // Normal Pointing Left
           
            GL11.glTexCoord2f(Hoffset,Voffset + size);   GL11.glVertex3f(-0.04f, -0.5f, -0.05f); // Bottom Left Of The Texture and Quad
            GL11.glTexCoord2f(Hoffset + size,Voffset + size);   GL11.glVertex3f(-0.04f, -0.5f, 0.05f); // Bottom Right Of The Texture and Quad
            GL11.glTexCoord2f(Hoffset + size,Voffset);GL11.glVertex3f(-0.07f, 0.3f, 0.05f); // Top Right Of The Texture and Quad
            GL11.glTexCoord2f(Hoffset, Voffset);   GL11.glVertex3f(-0.07f,0.3f, -0.05f); // Top Left Of The Texture and Quad
     
      GL11.glEnd();
   }
}


After i will know how to make my tool for example picaxe(axe actualy) then i will probably ask help for transperent blosk like glass which actualy need to work alredy besauce  Vermeer alredy added that to code and that worked for him.
Offline Longarmx
« Reply #177 - Posted 2013-12-28 22:51:39 »

If you wan't to make an axe, then you might want to create some code to load .obj files, because putting the vertex data manually is going to be a pain. Also, this is a trivial problem you are asking. It is clear that you have no idea what this code is doing. I would suggest starting at the basics. Follow this wiki article and learn how to develop games. Also, if you take a look at the lwjgl wiki, you would know that this renders a cube using what looks like a combo of display lists and immediate mode (correct me if I'm wrong).

Anyways, progress through the steps. Go console->2d->3d. Learn useful concepts on the way.

Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #178 - Posted 2013-12-29 00:48:06 »

Exactly. Copying others' code is never going to get you anywhere, especially when its large sections such as this.

Offline DreamHacker

Senior Newbie


Exp: 4-6 months



« Reply #179 - Posted 2013-12-29 10:47:20 »

so you still dont understand why i use others code?
I dont use this to make my own game and publish it somwhere.For now i am learnigng how all this is coded and slowly impliment new things to so in final i could make my own game.
This what Vermeer has done so far and i am taiing his code to study thats why i am asking to just explain me this code by just adding coments to those lines which i addded in my previous post?is it that hard?I dont even ask you to write code just //Comments about what some of thouse line do.
And looks like you dont even want to help me.
Pages: 1 ... 4 5 [6] 7
  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.

rwatson462 (35 views)
2014-12-15 09:26:44

Mr.CodeIt (26 views)
2014-12-14 19:50:38

BurntPizza (60 views)
2014-12-09 22:41:13

BurntPizza (95 views)
2014-12-08 04:46:31

JscottyBieshaar (55 views)
2014-12-05 12:39:02

SHC (71 views)
2014-12-03 16:27:13

CopyableCougar4 (73 views)
2014-11-29 21:32:03

toopeicgaming1999 (133 views)
2014-11-26 15:22:04

toopeicgaming1999 (124 views)
2014-11-26 15:20:36

toopeicgaming1999 (34 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!