Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (578)
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  Discussions / Miscellaneous Topics / Re: How to cheapen the Java brand! on: 2013-10-28 08:25:29


That is all.
2  Game Development / Shared Code / Re: Java Quadtree Implementation on: 2013-05-14 12:47:00
Just a side note:

You don't copy immutable objects. As they never change (mutate) there is no point in holding more than one copy. You reference it (which is cheaper).
3  Java Game APIs & Engines / OpenGL Development / Re: Shader Program Fatal Error on: 2013-05-12 17:13:28

Not according to the 1.50.09 spec
4  Java Game APIs & Engines / OpenGL Development / Re: Shader Program Fatal Error on: 2013-05-12 16:40:39
texture2D is deprecated.

1  
out_Color = texture2D(texture_diffuse, pass_TextureCoord);


should be

1  
out_Color = texture(texture_diffuse, pass_TextureCoord);


…not 100% sure that causes your problem though.
5  Game Development / Networking & Multiplayer / Re: Connect Java App to a Wordpress MYSQL Database on: 2013-05-11 11:44:39
Very good point! I didn't consider that. Before you know it somebody knows your db host and credentials.
6  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-11 08:50:12
So basically, when players collide, you want it such that each player treats the player he's colliding into like a wall?

That's exactly what I want! Smiley
7  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-11 08:47:39
I tried, but it seems like this too causes the two bodies to become stuck. I guess that when velocity is set to zero they stay in a colliding state. ?

What happens if you set the linear velocity to (0,0) only if the linear velocity is not (0,0)? This way, once they collide and their linear velocities are already at (0,0) --- you can move them again.

I think that's a better way of handling it than separating them just enough so that they could move again.

for example:

1  
2  
3  
4  
5  
6  
7  
8  
9  
if(fixtureA and fixtureB are both players){
   if(fixtureA.getBody().getLinearVelocity != (0,0)){
      fixtureA.getBody().setLinearVelocity(0.0f,0.0f);
   }

   if(fixtureB.getBody().getLinearVelocity != (0,0)){
      fixtureB.getBody().setLinearVelocity(0.0f,0.0f);
   }
}

Maybe you could try it out.
8  Game Development / Networking & Multiplayer / Re: Connect Java App to a Wordpress MYSQL Database on: 2013-05-11 08:07:21
MySQL has nothing to do with PHP. What you need to do is simply to connect to the database directly from you java code, and perform the (SQL) query. Do some google searches for "mysql java tutorial".

It might also be possible to decide if a user is succesfully authenticated based on the HTTP status codes. If wordpress does this in a sane way  Roll Eyes
9  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-10 21:50:11
Yes, what's wrong with setting restitution to 0?

You can push your opponent?
10  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-10 21:36:52
I want to achieve something similar to this game http://www.java-gaming.org/topics/iconified/26049/view.html Pointing

Players can block the way for others, but not being pushed.
11  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-10 17:27:39
A problem with this (naive?) strategy is that when two players collide… they are stuck Smiley

I suppose that a quick and dirty fix would be to manually separate them just enough to be able to carry on. Any other suggestions?
12  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-10 11:37:31
Cool. I'll try it out when I get some spare time.
13  Game Development / Game Mechanics / How would you do player-to-player collision with box2d? on: 2013-05-10 06:05:12
I'm trying to find a good way to achieve "correct" behavior when two players collide in a multiplayer game. My current situation is that when they collide, they apply forces to each other and starts spinning and changing direction.

I want them to be unable to walk through each other, but not to cause any force/impulse being applied. One idea I have is to add collision filtering for the players, and handle it manually.
14  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 14:51:11
Cool. Now I learned something too Smiley
15  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 13:46:37
I can't see how that code will work in the first place Tongue stride and offset = 0 for all vertex attr pointers?

Besides that, I don't see any obvious flaws. Show more code Smiley

I assume cube.obj only contains 8 vertices?
16  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 13:17:02
How slow?
17  Discussions / Miscellaneous Topics / Re: What music do you listen to while you code? on: 2012-11-19 12:53:31
At the moment (at work) I'm listening to the Super Meat Boy soundtrack

http://dbsoundworks.bandcamp.com/album/super-meat-boy-soundtrack
18  Game Development / Newbie & Debugging Questions / Re: New Guy who needs help on: 2012-10-17 05:09:22
Forget about graphics for a while. You need to learn programming Java first. Create some console applications until you feel more comfortable with the language.
19  Games Center / WIP games, tools & toy projects / Re: New FPS/RPG, A Work in Progress: Dysis on: 2012-10-05 14:00:12
Impressive. Looking forward to future teasers!
20  Discussions / Miscellaneous Topics / Re: Green!!! on: 2012-10-05 07:41:47
This made no sense to me at all. The loading text?
21  Game Development / Newbie & Debugging Questions / Re: Load MD5 Models in LWJGL on: 2012-10-04 20:39:02
If you don't want to use any other library than LWJGL, you'll have to read the MD5 format specification and write your own loader/renderer.
22  Discussions / General Discussions / Re: "goto" could be added to JDK8 on: 2012-04-02 20:31:07
Well, the article is dated april 1st  Roll Eyes

Also: http://xkcd.com/292/
23  Game Development / Newbie & Debugging Questions / Re: Best Library for 2D game development? Your experience. on: 2012-02-13 18:12:20
Take a look at libgdx and slick2d
24  Java Game APIs & Engines / OpenGL Development / Re: Render to texture (FBO) - result is upside down on: 2011-04-22 21:32:20
Yes, seems like that was the problem.

I went from this
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
 private void drawFullscreenQuad() {
    glBegin(GL_QUADS);
    glNormal3d(0, 0, 1);
    glTexCoord2f(0, 0);
    glVertex2f(0, 0);
    glTexCoord2f(1, 0);
    glVertex2f(width, 0);
    glTexCoord2f(1, 1);
    glVertex2f(width, height);
    glTexCoord2f(0, 1);
    glVertex2f(0, height);
    glEnd();
}

to this
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
private void drawFullscreenQuad() {
    glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2f(0, 0);
    glTexCoord2f(1, 1);
    glVertex2f(width, 0);
    glTexCoord2f(1, 0);
    glVertex2f(width, height);
    glTexCoord2f(0, 0);
    glVertex2f(0, height);
    glEnd();
}


and now it works fine. I think I was confused by the fact that in slick2d (0,0) is upper left corner.

Thanks for helping me sorting it out! Smiley
25  Java Game APIs & Engines / OpenGL Development / Re: Render to texture (FBO) - result is upside down on: 2011-04-22 20:37:03
Hmm. Could be! I forgot to mention that I'm using slick2d as well. I'm unsure if they use different corners for (0,0). Will report back when I find out.
26  Java Game APIs & Engines / OpenGL Development / Render to texture (FBO) - result is upside down on: 2011-04-22 19:47:12
I've managed to render to texture,  and also render the resulting texture on a quad. My problem is that the result is upside down and I cannot figure out why.

What I basically do is creating an instance of the following class with the screen size as width and height parameters. Then I activate it when I want to start rendering to texture, and deactivate it when I'm done. Then I fetch the result as a texture id, which I then bind to GL_TEXTURE_2D later on.

This works fine, but as I said from the beginning: it is upside down!


LWJGL code:

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  
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.*;

import java.nio.ByteBuffer;

public class FBORenderer {
    private int fbo;
    private int texture;
    private int height;
    private int width;
    private ByteBuffer byteBuffer;

    public FBORenderer(int w, int h) {
        fbo = ARBFramebufferObject.glGenFramebuffers();
        texture = GL11.glGenTextures();
        width = w;
        height = h;

        activate();

        byteBuffer = BufferUtils.createByteBuffer(4 * width * height);

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_BYTE, byteBuffer);


        ARBFramebufferObject.glFramebufferTexture2D(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER,
                ARBFramebufferObject.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture, 0);

        deactivate();
    }

    public void activate(){
        ARBFramebufferObject.glBindFramebuffer(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER, fbo);
    }

    public void deactivate() {
        ARBFramebufferObject.glBindFramebuffer(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER, 0);
    }

    public int getTexture() {
        return texture;
    }
}

27  Game Development / Newbie & Debugging Questions / Re: Render to texture using FBO - result texture is white on: 2011-04-18 17:01:03
Thanks to both of you!

The render texture stuff was just left overs from some trial and error. sorry Smiley

@Bonbon-Chan you were right about the texture filter. After adding that I got it working! Anyhow, I couldn't manage to call glTexImage2D with null as the last argument. If I try to create a smaller bytebuffer I get an error telling me that the buffer's size is x but must be y.
28  Game Development / Newbie & Debugging Questions / Render to texture using FBO - result texture is white on: 2011-04-17 18:30:20
I'm trying to render to texture using a FBO. I'm not sure what I'm doing wrong, but when rendering the resulting texture is all white. Below is some of my code. Please tell me if you see what I'm doing wrong. Am I missing something?

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  
// render code

renderToTexture.activate();
GL11.glPushAttrib(GL11.GL_VIEWPORT_BIT);
GL11.glViewport(0, 0, width, height);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

renderNoise();

p1.render();
p2.render();
ball.render();

renderToTexture.deactivate();
GL11.glPopAttrib();

SlickCallable.enterSafeBlock();
int rtt = renderToTexture.getTexture();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, rtt);

glBegin(GL_QUADS);
glNormal3d(0, 0, 1);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(width, 0);
glTexCoord2f(1, 1);
glVertex2f(width, height);
glTexCoord2f(0, 1);
glVertex2f(0, height);
glEnd();

glDisable(GL_TEXTURE_2D);
SlickCallable.leaveSafeBlock();

// fbo helper class
public class FBORenderer {
    private int fbo;
    private int rbo;
    private int texture;
    private int height;
    private int width;
    private ByteBuffer byteBuffer;

    public FBORenderer(int w, int h) {
        fbo = ARBFramebufferObject.glGenFramebuffers();
        texture = GL11.glGenTextures();
        width = w;
        height = h;

        activate();

        byteBuffer = BufferUtils.createByteBuffer(4 * 4 * width * height);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_FLOAT, byteBuffer);

        ARBFramebufferObject.glFramebufferTexture2D(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER,
                ARBFramebufferObject.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture, 0);

        deactivate();
    }

    public void activate(){
        ARBFramebufferObject.glBindFramebuffer(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER, fbo);
    }

    public void deactivate() {
        ARBFramebufferObject.glBindFramebuffer(ARBFramebufferObject.GL_DRAW_FRAMEBUFFER, 0);
        ARBFramebufferObject.glBindRenderbuffer(ARBFramebufferObject.GL_RENDERBUFFER, 0);
    }

    public int getTexture() {
        return texture;
    }
}
29  Java Game APIs & Engines / OpenGL Development / Re: Procedural Textures on: 2011-04-15 07:15:14
You're right. Turns out I did a lousy search job yesterday.

Thanks!
30  Java Game APIs & Engines / OpenGL Development / Procedural Textures on: 2011-04-14 21:06:08
I want to generate textures using for instance perlin noise. My problem is that I don't know how to create a texture from the color (RGB) data.

It would be nice if someone could provide a simple code sample or article/tutorial/resource for how this is done (preferrably with LWJGL) Smiley
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

DarkCart (17 views)
2014-10-31 21:44:48

DarkCart (22 views)
2014-10-31 21:43:57

TehJavaDev (40 views)
2014-10-27 03:28:38

TehJavaDev (31 views)
2014-10-27 03:27:51

DarkCart (44 views)
2014-10-26 19:37:11

Luminem (27 views)
2014-10-26 10:17:50

Luminem (30 views)
2014-10-26 10:14:04

theagentd (36 views)
2014-10-25 15:46:29

Longarmx (64 views)
2014-10-17 03:59:02

Norakomi (62 views)
2014-10-16 15:22:06
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!