Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2017-02-25 11:07:01 
Started by Flprll - Last post by Flprll
Oh I actually solved this by "accident".. It took way too long to do this, but I am very noob in this matrix stuff...  Roll Eyes

Decided to put this here if some as unskilled person as me is wondering the same thing..

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public Vector2f getScreenCoords(Matrix4f viewMatrix, Matrix4f projectionMatrix) {

      Matrix4f modelViewMatrix = new Matrix4f();
      modelViewMatrix = Matrix4f.mul(viewMatrix, transformationMatrix, modelViewMatrix);
     
        viewProjectionMatrix = Matrix4f.mul(projectionMatrix, modelViewMatrix, viewProjectionMatrix);
       
       
        Matrix4f worldCoords = viewProjectionMatrix;
       
        float x = worldCoords.m00 + worldCoords.m10 + worldCoords.m20 + worldCoords.m30;
        float y = worldCoords.m01 + worldCoords.m11 + worldCoords.m21 + worldCoords.m31;
        float z = worldCoords.m02 + worldCoords.m12 + worldCoords.m22 + worldCoords.m32;
        float w = worldCoords.m03 + worldCoords.m13 + worldCoords.m23 + worldCoords.m33;
       
        float finalX = (x / z);
        float finalY = (y / z);
       
       
        System.out.println(y);
       
        return new Vector2f(finalX, finalY);
   }


...At least it seems to work just fine persecutioncomplex

 2 
 on: 2017-02-25 05:18:14 
Started by BurntPizza - Last post by Coldstream24
breaking stuff is fun
<a href="http://www.youtube.com/v/zUgfjDyZ7ys?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/zUgfjDyZ7ys?version=3&amp;hl=en_US&amp;start=</a>

 3 
 on: 2017-02-25 04:02:39 
Started by ShadedVertex - Last post by ShadedVertex
I recently heard of Quasi-random sequences and quasi-monte carlo integration, and it made me wonder, would using Quasi Monte Carlo Integration for Screen Space Ambient Occlusion result in an improvement in the quality of the effect? Would there be a noticeable difference?

 4 
 on: 2017-02-24 18:13:04 
Started by BurntPizza - Last post by CJC
I've improved the templating system of my Commodore BASIC/6502 assembly language fun project, so that it's actually usable in combination with a normal web framework.

I'm not sure, but this might be the only webpage whose template has been written in 6502 assembly code (scroll down the page to see the actual code): goo.gl/5vc7cd (there's BASIC version as well that uses the labels-instead-of-line-numbers-option that I've added to the compiler recently: goo.gl/dcxCtc).

Some people are just show offs. Tongue

In less impressive news, I had some fun messing with libGDX and it's port of Box2D. Let me just say, those error messages are about as useless as they come. But, in the end, I created a projectile that will place a "gravity well" (the big circle in the video). And I allowed bullets (the small circles) to be pulled by said mass. Fun result. Cheesy

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


 5 
 on: 2017-02-24 18:10:36 
Started by Chennorris - Last post by elect
Hi Chennorris,


in the fragment you can write

1  
outColor = texture(textureCubemap, textureCoordinates);



in your bufferData() you are quering if binded and if not, you generate the texture.

Texture binding and texture name generation poorly match.

You should generate the texture name a priori, once, at begin and then re-use it until you need and then delete.

During the runtime, bind the name before rendering.

Prefer IntBuffers over int arrays.

1  
2  
        IntBuffer cubeMapName = GLBuffers.newDirectIntBuffer(1);
        gl.glGenTextures(1, bufferName);


In the init, when you match a sampler to a texture index, be sure you got the program bound and use variable, if possible, to proper index you samples in order to be less error prone as possible and make your code readable
1  
2  
3  
4  
5  
6  
7  
interface Sampler {
    int CUBEMAP = 0;
}

gl.glUseProgram(program);
gl.glUniform1i(FxManager.textureCubemapHandler, Sample.CUBEMAP);
gl.glUseProgram(0);


And in the rendering

1  
2  
    gl.glActiveTexture(GL_TEXTURE0 + Sampler.CUBEMAP);
    gl.glBindTexture(GL_TEXTURE_2D, cubeMapName);


However, be aware that a cubeMap is a special texture to render landscapes and similar (more info here), if you want to texture a box, you can render:

- one face per time binding the corresponding texture (6 textures)
- the whole box in one step binding one big texture containing all the faces, like here

 6 
 on: 2017-02-24 16:58:16 
Started by Optimo - Last post by Optimo
That was my feeling. TYSM, theagentd!  Grin

 7 
 on: 2017-02-24 16:10:19 
Started by Chennorris - Last post by Chennorris
Hello everyone,
This is my very first time in hear so sorry in advance if I forgot anything ^^

I'm currently working on a 3D game in java and I've chosen to work with the library JOGL. The reason of this new topic is that I'm currently stuck on the problem of displaying a skybox :
  • I managed to display a cube which is not textured,
  • The cube is displaying in the background, so the depth test is correctly disabled for rendering the skybox,
  • But the cube is always black Sad

My fragment shader looks like this :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
#version 400

in vec3 textureCoordinates;

out vec4 outColor;

uniform samplerCube textureCubemap;
//uniform sampler2D textureCubemap; -> used when I wanna test my shader with a classic 2D texture

void main (void) {
    // The following line demonstrates that the coordinates are correctly used for sampling the texture
    //outColor = vec4(textureCoordinates, 1);

    // The following line permits to test the shader with a classic 2D texture
    //outColor = texture(textureCubemap, textureCoordinates.xy);

    // The following line is intended to work with a texture cubemap (but always displays a black cube)
    outColor = vec4(texture(textureCubemap, textureCoordinates).xyz, 1);
}


In Java, here's my code for rendering the cubemap with a 3D texture (so this is the code that is not working) :
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  
private void bufferData(GL3 gl) {
    // Setting the texture handler
    if (!isBinded) {
        int[] ids = new int[1];
        gl.glGenTextures(1, ids, 0);
        textureCubeMapHandler = ids[0];
        isBinded = true;
    }

    // Activating and buferring the texture
    gl.glActiveTexture(GL.GL_TEXTURE0);
    gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, textureCubeMapHandler);
    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);

    // Buffering the X faces textures
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, positiveX.getInternalFormat(), positiveX.getWidth(),
            positiveX.getHeight(), 0, positiveX.getPixelFormat(), positiveX.getPixelType(),
            positiveX.getBuffer());
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, negativeX.getInternalFormat(), negativeX.getWidth(),
            negativeX.getHeight(), 0, negativeX.getPixelFormat(), negativeX.getPixelType(),
            negativeX.getBuffer());

    // Buffering the Y faces textures
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, positiveY.getInternalFormat(), positiveY.getWidth(),
            positiveY.getHeight(), 0, positiveY.getPixelFormat(), positiveY.getPixelType(),
            positiveY.getBuffer());
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, negativeY.getInternalFormat(), negativeY.getWidth(),
            negativeY.getHeight(), 0, negativeY.getPixelFormat(), negativeY.getPixelType(),
            negativeY.getBuffer());

    // Buffering the Z faces textures
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, positiveZ.getInternalFormat(), positiveZ.getWidth(),
            positiveZ.getHeight(), 0, positiveZ.getPixelFormat(), positiveZ.getPixelType(),
            positiveZ.getBuffer());
    gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, negativeZ.getInternalFormat(), negativeZ.getWidth(),
            negativeZ.getHeight(), 0, negativeZ.getPixelFormat(), negativeZ.getPixelType(),
            negativeZ.getBuffer());

    gl.glUniform1i(FxManager.textureCubemapHandler, 0);
}


And for the comparison, here's the code I use to display the cubemap with a 2D texture (which is the code that is working) :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
private void buffer2dData(GL3 gl) {
    // Setting the texture handler
    if (!isBinded) {
        int[] ids = new int[1];
        gl.glGenTextures(1, ids, 0);
        textureCubeMapHandler = ids[0];
        isBinded = true;
    }

    // Activating and buffering the texture
    gl.glActiveTexture(GL.GL_TEXTURE0);
    gl.glBindTexture(GL.GL_TEXTURE_2D, textureCubeMapHandler);
    gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, texture2d.getInternalFormat(), texture2d.getWidth(),
            texture2d.getHeight(), 0, texture2d.getPixelFormat(), texture2d.getPixelType(),
            texture2d.getBuffer());
    gl.glGenerateMipmap(GL.GL_TEXTURE_2D);
    gl.glUniform1i(FxManager.textureCubemapHandler, 0);
    gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
    gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
}


With only those lines of code, can anyone manage to see what may be wrong in my code for rendering with a 3D texture ? I was thinking about some parameterization missing (GL.GL_TEXTURE_WRAP_R doesn't exist and I don't know why 'cos I saw this int in a lot of examples on the net) but maybe it could come from another problem.

Don't hesitate to ask more information if needed and thanks in advance for any help.

 8 
 on: 2017-02-24 12:33:28 
Started by Optimo - Last post by theagentd
The latest nightly build of LWJGL should include the 3.3 beta version of GLFW. I use it right now. =P

 9 
 on: 2017-02-24 12:20:42 
Started by Mac70 - Last post by Abuse
@Abuse, I think all tests should allow laptops and spreadsheets, mostly for the ability to easily save and see intermediate results which is hard in a calculator, and to be able to see the history of working in prior cells' working to spot an error.

Are we imagining different examination techniques?
I'm still imagining paper examinations where the calculator simply supplements the written word; it's the responsibility of the student to record their working on the examination paper.

What you're suggesting sounds like a transition to completely digital examination, and while that paradigm shift is in the works, it's yet to become mainstream here in the UK.
I do agree though; digitally recording all intermediate working would be a much better way of evaluating a student's level of understanding, but spreadsheets are not the ideal tool for that purpose.

Quote
and regular * not x and / not รท symbols which are encountered all over the workplace and in everyday life.

Mathematical operator symbology is indeed a mess, and the pervasiveness of competing Computer Science symbology has only muddied the water further.
That's a whole different topic though.

 10 
 on: 2017-02-24 11:11:16 
Started by BurntPizza - Last post by EgonOlsen
I've improved the templating system of my Commodore BASIC/6502 assembly language fun project, so that it's actually usable in combination with a normal web framework.

I'm not sure, but this might be the only webpage whose template has been written in 6502 assembly code (scroll down the page to see the actual code): goo.gl/5vc7cd (there's BASIC version as well that uses the labels-instead-of-line-numbers-option that I've added to the compiler recently: goo.gl/dcxCtc).

Pages: [1] 2 3 ... 10
 
numerical (216 views)
2017-02-21 07:32:16

numerical (216 views)
2017-02-21 07:31:46

theagentd (326 views)
2017-02-18 13:42:33

theagentd (327 views)
2017-02-18 13:35:16

h.pernpeintner (1490 views)
2017-01-24 22:39:11

h.pernpeintner (1478 views)
2017-01-24 22:38:32

Galdo (2043 views)
2017-01-12 13:44:09

Archive (2070 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2608 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2338 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!