Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (682)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (750)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8 9 10
 61 
 on: 2016-07-19 20:29:17 
Started by matt_p - Last post by Spasi
You're using ByteBuffer.wrap in loadImageToByteBuffer. This returns a heap ByteBuffer, which is not supported by LWJGL 3. This post explains why.

 62 
 on: 2016-07-19 20:11:46 
Started by CopyableCougar4 - Last post by CopyableCougar4
My matrix multiplication order is boneMatrix * inverseBindPose.

I compute the bindpose matrix with
1  
2  
3  
translation = bindPose.getTranslation();
      bindPoseMatrix.translationRotate(translation.x, translation.y, translation.z, bindPose.getOrientation());
      bindPoseMatrix.invert(invBindPoseMatrix);

for each bone, where translation and orientation are based on the baseframe data (with w computed like shown in a previous post).

I compute the bone matrices with
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  
int jointIdx = index[0];
         if (parent == null) {
            frameData[jointIdx + 0] = position.x;
            frameData[jointIdx + 1] = position.y;
            frameData[jointIdx + 2] = position.z;
            frameData[jointIdx + 3] = orientationQuat.x;
            frameData[jointIdx + 4] = orientationQuat.y;
            frameData[jointIdx + 5] = orientationQuat.z;
            frameData[jointIdx + 6] = orientationQuat.w;
         } else {
            int parentJointIdx = startIndices.get(new JointID(parent.getName()));
            parentPos.x = frameData[parentJointIdx + 0];
            parentPos.y = frameData[parentJointIdx + 1];
            parentPos.z = frameData[parentJointIdx + 2];
            parentOrient.x = frameData[parentJointIdx + 3];
            parentOrient.y = frameData[parentJointIdx + 4];
            parentOrient.z = frameData[parentJointIdx + 5];
            parentOrient.w = frameData[parentJointIdx + 6];
            parentOrient.transform(position);
            frameData[jointIdx + 0] = position.x + parentPos.x;
            frameData[jointIdx + 1] = position.y + parentPos.y;
            frameData[jointIdx + 2] = position.z + parentPos.z;
            parentOrient.mul(orientationQuat);
            parentOrient.normalize();
            frameData[jointIdx + 3] = parentOrient.x;
            frameData[jointIdx + 4] = parentOrient.y;
            frameData[jointIdx + 5] = parentOrient.z;
            frameData[jointIdx + 6] = parentOrient.w;
         }
         startIndices.put(id, jointIdx);
         Vector3f pos = new Vector3f();
         pos.x = frameData[jointIdx + 0];
         pos.y = frameData[jointIdx + 1];
         pos.z = frameData[jointIdx + 2];
         Quaternionf orient = new Quaternionf(0, 0, 0, 1);
         orient.x = frameData[jointIdx + 3];
         orient.y = frameData[jointIdx + 4];
         orient.z = frameData[jointIdx + 5];
         orient.w = frameData[jointIdx + 6];

and then use Matrix4f.translationRotate(pos.x, pos.y, pos.z, orient).

The above code basically takes the frame data, replaces baseframe data based on the flags, and then adds that to the parent frame data. (I believe I pulled this code snippet from an early version of LibGDX).

 63 
 on: 2016-07-19 19:29:47 
Started by FabulousFellini - Last post by FabulousFellini
I started messing around with an XBox 360 controller and for the most part it works, but I came across a little hickup.  I want to use the left stick to control the player's movement.  The player can only go left or right most of the time.  Here is the code I have:  (When the stick is not being used it is centered, at 50 percent).

if(joystick.getXAxisPercentage() < 40)
        player.moveLeft();
if(joystick.getXAxisPercentage() > 60)
        player.moveRight();

This works well, but only when the stick is seemingly centered on the YAxis (50 percent).  As soon as you veer off on the center of the Y Axis a little bit, the player stops moving, even if the XAxisPercentage is over 60.  I tried adding checks for the Y Axis as well, but it did the same thing.  Shouldn't the player keep moving even if the Y Axis isnt centered, or am I missing something?


 64 
 on: 2016-07-19 18:25:16 
Started by matt_p - Last post by matt_p
Hello,

I somehow got informed that GLFW 3.2 added support for icons - and that this should work in LWJGL 3.0 too (right?)... I tried to implement it and failed miserably.

Facts: Windows 10 64bit, LWJGL 3.0 (using 64bit Java 1.8, therefore 64bit natives: latest release)

Following code does not work:
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  
    public static void setIcon(long window, BufferedImage img) {
        GLFWImage image = GLFWImage.malloc();
        image.set(img.getWidth(), img.getHeight(), loadImageToByteBuffer(img));

        GLFWImage.Buffer images = GLFWImage.malloc(1);
        images.put(0, image);

        GLFW.glfwSetWindowIcon(window, images);

        images.free();
        image.free();
    }

    private static ByteBuffer loadImageToByteBuffer(final BufferedImage image) {
        final byte[] buffer = new byte[image.getWidth() * image.getHeight() * 4];
        int counter = 0;
        for (int i = 0; i < image.getHeight(); i++) {
            for (int j = 0; j < image.getWidth(); j++) {
                final int c = image.getRGB(j, i);
                buffer[counter + 0] = (byte) (c << 8 >> 24);
                buffer[counter + 1] = (byte) (c << 16 >> 24);
                buffer[counter + 2] = (byte) (c << 24 >> 24);
                buffer[counter + 3] = (byte) (c >> 24);
                counter += 4;
            }
        }
        return ByteBuffer.wrap(buffer);
    }


Note: the loadImageToByteBuffer used to work with LWJGL 2.9.x in some ways, so I had icons on my application prior to the switch to 3.0  Wink

I already searched around and the setIcon is actually from a stackoverflow (apparently working) answer.

The feedback I get when it crashes is that the LWJGLs checkPointer method from class Checks returns null after the GLFWImage validate method returns 0 as the pointer (although it is called with a pointer thats at least not 0) - this happens in the glfwSetWindowIcon method.

The image I try to set is a 48x48 PNG with alpha and is loaded via ImageIO.

Need help

Thank you very much
Matt_P

 65 
 on: 2016-07-19 12:48:23 
Started by BurntPizza - Last post by orange451
I started working on my Army Men game again.

 66 
 on: 2016-07-19 11:25:08 
Started by printer - Last post by printer
Thank you for your answer. Can you provide any examples from what i've posted.

 67 
 on: 2016-07-19 11:11:05 
Started by lvivtotoro - Last post by lvivtotoro
It's said on the Gamejolt page that i'd change the music later.
The guy that made the remix said it's free to use.

 68 
 on: 2016-07-19 10:14:07 
Started by BurntPizza - Last post by J0
Find exploit in Google product and sell it on black market - is Light Black.
That's kind of gray — although a gray hat would rather tell Google they found a vulnerability but not which one until they pay or something.

 69 
 on: 2016-07-19 09:01:38 
Started by BurntPizza - Last post by Icecore
I'm kind of hoping the answer to be black just for the lolz Roll Eyes
Black - also have colors XD
Create encrypter to scam ppl for money - is Dark Black,
Find exploit in Google product and sell it on black market - is Light Black.
(because official Google some times can give you 500$ max or even "We take it - Thanks")

 70 
 on: 2016-07-19 07:00:15 
Started by BurntPizza - Last post by J0
Also, grey/white/black... ?
I'm kind of hoping the answer to be black just for the lolz Roll Eyes

Pages: 1 ... 5 6 [7] 8 9 10
 
orrenravid (141 views)
2016-07-16 03:57:23

theagentd (210 views)
2016-07-11 14:28:54

Hydroque (293 views)
2016-07-06 05:56:57

Hydroque (441 views)
2016-07-03 08:52:54

GrandCastle (327 views)
2016-07-01 09:13:47

GrandCastle (321 views)
2016-07-01 09:09:45

CopyableCougar4 (376 views)
2016-06-25 16:56:52

Hydroque (360 views)
2016-06-22 02:17:53

SwampChicken (331 views)
2016-06-20 13:22:57

SwampChicken (281 views)
2016-06-20 13:22:49
Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42

FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17
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!