Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (163)
games submitted by our members
Games in WIP (632)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Game Development / Newbie & Debugging Questions / Shadow map is not filled properly on: 2015-05-20 15:00:10
Hello. I am implementing shadow mapping using LWJGL, but for some reason the shadow map is filled in a really weird, low quality way.



The rectangle in bottom-left corner is the shadow map drawn from same position and direction as the camera. It seems like it's filled with a binary 1 or 0 value instead of the z and even though the shadow map is 1024x1024 I can see the gaps between triangles, which is weird.

Also for some reason the texture does not update. By that I mean that if I eg. add glClear(DEPTH_BUFFER_BIT) before drawing to shadow map, the whole texture just turns white. So for some reason the texture is drawn to only once although I made sure I draw the models each frame.

I decided not to post any code here because it's all split into bunch of files and I'm not exactly sure what part could be causing this, but if this is not some kind of "forgot to turn on a flag" error which I'm hoping it to be I can post some code.

Edit: here's the probably most relevant class ShadowMapFBO: http://pastebin.java-gaming.org/109458f762111

Edit2: Turns out I forgot to set depth func back to GL_LESS after some operations. Caffeine is the best debugging tool  Smiley
2  Game Development / Networking & Multiplayer / Re: Servers on: 2012-11-16 06:47:58
And if you actually want your server to run stable, don't go with the cheapest one.

Linode is one I can recommend.
3  Game Development / Newbie & Debugging Questions / Re: Debug Uncaught Exceptions on: 2012-10-14 00:54:43
IIRC Eclipse does this automatically if you start the program in debug mode.
4  Game Development / Newbie & Debugging Questions / Re: Got XYZ cordinates, now I have to move it further away from its current location on: 2012-07-07 12:24:15
EndPoint + EndPoint.normalize().mul(amount)
5  Game Development / Newbie & Debugging Questions / Re: JFrame.setPreferredSize() is not working consistently on: 2012-06-23 10:10:43
What works for me is calling setSize and setPreferredSize both with same value.
6  Game Development / Newbie & Debugging Questions / Re: FPS difference on: 2012-04-10 10:24:35
Maybe the hardware graphics acceleration is enabled on your computer but not on your friend's
7  Game Development / Newbie & Debugging Questions / Re: Array of ArraList? on: 2012-03-17 20:17:24
It does work.

Initializing generic array however doesnt (T[]) which is probably what you meant.
8  Java Game APIs & Engines / OpenGL Development / Re: Where to go? Wich Java OpenGL 3D engine on: 2012-03-04 13:39:59
LibGDX sounds like a perfect choice then. It abstracts model loading and even mdl animation (+ tons of other things) but allows you to use opengl where-ever you want.
9  Game Development / Newbie & Debugging Questions / Re: java.awt.Shape and mouse event on: 2012-02-29 16:02:23
Are you having performance problems with the current solution?
10  Games Center / 4K Game Competition - 2012 / Re: Bounce 2 the End on: 2012-02-08 07:09:07
Runs too fast to really see what's going. You should probably limit updates per second Tongue Also my balls(squares?) sometime flew outside the window and I couldn't finish the level. Otherwise promising looking game Smiley
11  Game Development / Game Play & Game Design / Re: your turn / my turn logic on: 2012-02-07 11:18:29
1  
2  
3  
4  
    public interface State extends KeyListener, MouseListener, MouseMotionListener{
        public void next(Graphics g);   //I'm not allowed to call it Update for some reason  :(
        //Probably because of a collision with the built in function in Swing with the same name
    }

And then just register the current state as a listener and you won't have to pass events through to the current state in your state handling code.  Wink

Whaaat. I didn't know interfaces can extend multiple interfaces. Life quality improved!
12  Java Game APIs & Engines / OpenGL Development / Re: Vertex Array - beginner problem on: 2012-02-01 08:30:38
You probably missed the vertex array..
13  Game Development / Newbie & Debugging Questions / Re: Tile Map Distortion? Or just general screen distortion? on: 2012-01-30 20:25:59
Do you use lwjgl, slick or java2d? Shaders would probably do the job.
14  Game Development / Newbie & Debugging Questions / Re: Multi-Dimensional Generic Arrays on: 2012-01-29 19:41:51
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/reflect/Array.html#newInstance(java.lang.Class,%20int[])
15  Game Development / Newbie & Debugging Questions / Re: Checking arrays equal on: 2012-01-29 19:38:15
Probably because its a multidimensional array and Arrays.equals is therefore comparing int[] array references. You could for loop through first dimension and use Arrays.equals on each second dimension array.
16  Game Development / Newbie & Debugging Questions / Re: problems with animation on: 2012-01-24 20:49:07
Unable to check the applet but I'm fairly sure the problem is that you're not using double buffering. Luckily its fairly easy to implement
17  Game Development / Game Mechanics / Re: Simple AI Programming on: 2012-01-22 20:56:15
Position += Velocity

For path finding you should probably look up A*. There is this tutorial (for tile based maps though) on kevglass's site http://cokeandcode.com/index.html?page=tutorials/tilemap2
18  Game Development / Game Play & Game Design / Re: Very slow start up on: 2012-01-21 22:21:38
Ah crap, somehow misread that they are static. They're loaded in constructor then   Roll Eyes
19  Game Development / Game Play & Game Design / Re: Very slow start up on: 2012-01-21 22:00:21
Because the images are loaded in a static initializer block before the gui is shown. You could just load them locally instead of downloading from internet  persecutioncomplex
20  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException on: 2012-01-18 07:42:43
1  
2  
3  
public void menuInit()
{
   for (Boulder b : boulders) boulders.remove(b);


I didn't download the sources but if the loop looks like that you could use boulders.clear() instead of that.
21  Discussions / General Discussions / Re: Noticed something on minecraft.net... on: 2012-01-05 12:32:39
and 100 Guests are viewing this topic.

 Grin
22  Game Development / Newbie & Debugging Questions / Re: Runtime.getRuntime().exec in different directory on: 2012-01-03 00:02:26
Try Runtime.exec("java -jar game.jar", null, new File("game/"))
23  Game Development / Newbie & Debugging Questions / Re: Extremely confusing NoClassDefFoundError problem on: 2012-01-02 13:01:46
Eclipse somehow stops compiling classes in specific project for some weird reason (have had it a couple of times and only way to fix it was to make a new project and copy sources to it) Maybe check the errors view of eclipse because they might prevent compiling yet keep old classes there.

Edit: didn't read you confirmed the subclass files are there. Hmm, no idea then :/
24  Game Development / Newbie & Debugging Questions / Re: Sound Blocking Problem on: 2012-01-01 10:27:48
That's not a thread. You're just calling a method normally. To make it run in a thread replace
1  
soundManager.run()
with
1  
new Thread(soundManager).start();
That's not an optimal solution though because you load sounds from a file everytime you play them, thus generating massive IO traffic. Instead you should cache SoundManagers beforehand and use single instances of them from the main logic thread. And if you for some reason (there are pretty much none) decide to go with threaded way, at least use thread pools.
25  Games Center / LWJGL16k - 2011 / Re: Roll up, roll up! on: 2011-12-16 13:26:37
Yes I do
26  Games Center / Cube World Projects / Re: VBOs not working on: 2011-12-03 13:53:13
Okay solved this in IRC with assistance from ra4king and MatthiasM! In case someone in distant future reads this you need to flip the buffer as ra4king said and the VBO size must be in bytes.
27  Games Center / Cube World Projects / VBOs not working on: 2011-12-03 13:18:00
So I tried to get VBOs to work but it doesn't render anything and I couldn't find anything being the noob I am  Shocked

Here's the code for rendering a box
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  
public class TestModel implements Model {
   
   int vertexBufferID;
   
   // cube ///////////////////////////////////////////////////////////////////////
   //  v6----- v5
   // /|      /|
   //v1------v0|
   //| |     | |
   //| |v7---|-|v4
   //|/      |/
   //v2------v3
   
   //vertex coords array
   FloatBuffer vertices = BufferUtils.createFloatBuffer(3 * 24).put(new float[] {1,1,1,  -1,1,1,  -1,-1,1,  1,-1,1,        // v0-v1-v2-v3
                       1,1,1,  1,-1,1,  1,-1,-1,  1,1,-1,        // v0-v3-v4-v5
                       1,1,1,  1,1,-1,  -1,1,-1,  -1,1,1,        // v0-v5-v6-v1
                       -1,1,1,  -1,1,-1,  -1,-1,-1,  -1,-1,1,    // v1-v6-v7-v2
                       -1,-1,-1,  1,-1,-1,  1,-1,1,  -1,-1,1,    // v7-v4-v3-v2
                       1,-1,-1,  -1,-1,-1,  -1,1,-1,  1,1,-1});   // v4-v7-v6-v5
   
   //normal array
   FloatBuffer normals = BufferUtils.createFloatBuffer(3 * 24).put(new float[] {0,0,1,  0,0,1,  0,0,1,  0,0,1,             // v0-v1-v2-v3
                      1,0,0,  1,0,0,  1,0,0, 1,0,0,              // v0-v3-v4-v5
                      0,1,0,  0,1,0,  0,1,0, 0,1,0,              // v0-v5-v6-v1
                      -1,0,0,  -1,0,0, -1,0,0,  -1,0,0,          // v1-v6-v7-v2
                      0,-1,0,  0,-1,0,  0,-1,0,  0,-1,0,         // v7-v4-v3-v2
                      0,0,-1,  0,0,-1,  0,0,-1,  0,0,-1});        // v4-v7-v6-v5
   
   //color array
   FloatBuffer colors = BufferUtils.createFloatBuffer(3 * 24).put(new float[] {1,1,1,  1,1,0,  1,0,0,  1,0,1,              // v0-v1-v2-v3
                     1,1,1,  1,0,1,  0,0,1,  0,1,1,              // v0-v3-v4-v5
                     1,1,1,  0,1,1,  0,1,0,  1,1,0,              // v0-v5-v6-v1
                     1,1,0,  0,1,0,  0,0,0,  1,0,0,              // v1-v6-v7-v2
                     0,0,0,  0,0,1,  1,0,1,  1,0,0,              // v7-v4-v3-v2
                     0,0,1,  0,0,0,  0,1,0,  0,1,1});             // v4-v7-v6-v5
   
   public TestModel() {
      vertexBufferID = createVBOID();
      System.out.println("VBO id: " + vertexBufferID);
      renderToVbo();
   }
   
   public static int createVBOID() {
      if (GLContext.getCapabilities().GL_ARB_vertex_buffer_object) {
         IntBuffer buffer = BufferUtils.createIntBuffer(1);
         ARBVertexBufferObject.glGenBuffersARB(buffer);
         return buffer.get(0);
      }
      return 0;
   }

        // Helper method
   public int sizeof(FloatBuffer fb) {
      return fb.capacity();
   }
   
   public void renderToVbo() {
     
     
      ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vertexBufferID);
     
      ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, sizeof(vertices)+sizeof(normals)+sizeof(colors), ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
      ARBVertexBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0, vertices);                             // copy vertices starting from 0 offest
      ARBVertexBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, sizeof(vertices), normals);                // copy normals after vertices
      ARBVertexBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, sizeof(vertices)+sizeof(normals), colors);  // copy colours after normals
     
   }

   
   @Override
   public void render() {

     
      ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vertexBufferID);

      GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
      GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
      GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);

      GL11.glNormalPointer(GL11.GL_FLOAT, 0, sizeof(vertices));
      GL11.glColorPointer(3, GL11.GL_FLOAT, 0, (sizeof(vertices)+sizeof(normals)));
      GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);

      GL11.glDrawArrays(GL11.GL_QUADS, 0, 24);
     
      GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);  // disable vertex arrays
      GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
      GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);

                ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);

   }

}


To render it I simply use testModel.render()
28  Game Development / Newbie & Debugging Questions / Re: One Programinstance on: 2011-11-26 17:17:17
You're probably gonna have to use some shady Runtime.exec implementation then which is bad because debugging becomes a pain and screen just werks.
29  Game Development / Networking & Multiplayer / Re: [Kryonet] Client Listener does not react on: 2011-11-21 06:32:14
You should name your class to something else than Connection, because at the moment the received method doesn't override anything because Listener class doesn't obviously have corresponding method for receiving your Connection objects Smiley This is why suppressing warnings is bad if you don't know what they mean.
30  Game Development / Newbie & Debugging Questions / Particles on: 2011-10-29 16:42:32
So I stumbled upon this OpenGL benchmarking test that uses LWJGL.
http://www.have2chat.net/benchmark

I'm particularly interested in how was the particle swing made. It looks awesome and fairly easy to replicate but I'm not sure how.
Pages: [1] 2
 
theagentd (10 views)
2015-05-27 22:21:17

theagentd (13 views)
2015-05-27 22:21:08

CopyableCougar4 (17 views)
2015-05-27 19:24:50

MrMapcom (24 views)
2015-05-23 20:26:16

MrMapcom (32 views)
2015-05-23 20:23:34

Waterwolf (37 views)
2015-05-20 15:01:45

chrislo27 (44 views)
2015-05-20 03:42:21

BurntPizza (79 views)
2015-05-10 15:53:18

FrozenShade (63 views)
2015-05-07 09:11:21

TheLopais (226 views)
2015-05-06 13:36:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

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