Hello Guest

Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Lightweight Java Gaming Library / Re: MSAA in Frame Buffer Objects
« Last post by KaiHH on May 16, 2018, 17:21:26 »
You cannot have a non-multisampled color attachment and multisampled color attachment (be they either textures or renderbuffers) at the same time in the same FBO. You will get a GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE error on glCheckFramebufferStatus().
Also, using GL_RENDERBUFFER as read or draw buffer does not make any sense. It's like using GL_TEXTURE_2D for it. With a FBO you have to tell which attachment(s) of the FBO you actually want to read/write, which are depth, stencil, depth+stencil or one of the color attachments. And those attachments can either be backed by a renderbuffer or a texture, which is specified with either glFramebufferRenderbuffer(..., attachment, ...)  or glFramebufferTexture*D(..., attachment, ...) or any of their multisampled variants.
22
Lightweight Java Gaming Library / MSAA in Frame Buffer Objects
« Last post by smokethepot on May 16, 2018, 16:47:19 »
I was reading up on MSAA in FBOs and found out that you can create multi-sampled renderbuffers in a frame buffer and then to display them, blit them either to the screen or to some other framebuffer which is not multi-sampled. In the case of blitting it to another framebuffer sample code would look like,

Code: [Select]
public void blitToFBO(FBO fbo){
      GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, frameBuffer);
      GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, fbo.frameBuffer);
      GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, fbo.width, fbo.height, GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT, GL11.GL_NEAREST);
       unbindFrameBuffer();
}
,if I'm not mistaken.

This got me thinking, can we create a single frame buffer with a multisampled render buffer and a color attachment and then internally blit the render buffer to the color attachment?
I've written some possible code for it:
Code: [Select]
GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, frameBuffer);
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, frameBuffer);
GL11.glReadBuffer(GL30.GL_RENDERBUFFER);
GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);
GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT, GL11.GL_NEAREST);


The only problem is that nowhere in the documentation does it state that GL_RENDERBUFFER is an acceptable parameter for the glReadBuffer(int) method, which means that it most probably isn't. If it is possible, can someone provide some alternative code to make it work. If it's not possible, can someone provide some explaination as to where am I going wrong in my idea.

Thanks in advance.
23
OpenGL / Re: Translation to world coordinates
« Last post by gibson on May 15, 2018, 20:35:26 »
Code: [Select]
  Vector3f worldCoords = new Matrix4f(pMatrix).mul(view).unproject(x, y, z,
    new int[] { 0, 0, wdwWidth, wdwHeight }, new Vector3f());
All the time in the center is displayed
24
OpenGL / Re: Translation to world coordinates
« Last post by KaiHH on May 15, 2018, 18:57:38 »
Code: [Select]
  Vector3f worldCoords = new Matrix4f(pMatrix).mul(view).unproject(x, y, z,
    new int[] { 0, 0, wdwWidth, wdwHeight }, new Vector3f());
25
OpenGL / Translation to world coordinates
« Last post by gibson on May 15, 2018, 14:56:16 »
I have mouse coordinates: mousePos, a matrix view view, and a perspective projection matrix pMatrix.

I translate the coordinates into the world: I find the inverse projection matrix and the inverse matrix view and multiply by the coordinates of the mouse. The coordinates of the origin is z = 4, the coordinates of the end is z = -100.

In the first case, I get the coordinates mouseDir1 = (-0.1985 0.02887 4), and in the second case mouseDir2 = (-0.1985 0.02887 -100).

Why are the coordinates x, y the same?

Code: [Select]
private Vector3f getCoord(MouseInput mouseInput,float z){
        int wdwWitdh = 640;
        int wdwHeight =640;

        Vector2d mousePos = mouseInput.getCurrentPos();
        float x = (float)(2 * mousePos.x) / (float)wdwWitdh - 1.0f;
        float y = 1.0f - (float)(2 * mousePos.y) / (float)wdwHeight;

        Matrix4f invProjectionMatrix = new Matrix4f();
        invProjectionMatrix.set(pMatrix);
        invProjectionMatrix.invert();
        Vector4f tmpVec = new Vector4f();
        tmpVec.set(x, y, z, 0);
        tmpVec.mul(invProjectionMatrix);
        tmpVec.z = z;
        tmpVec.w = 0.0f;

        Matrix4f viewMatrix = new Matrix4f().set(view);
        Matrix4f invViewMatrix = new Matrix4f();
        invViewMatrix.set(viewMatrix);
        invViewMatrix.invert();
        tmpVec.mul(invViewMatrix);
        Vector3f mouseDir1 = new Vector3f();
        mouseDir1.set(tmpVec.x, tmpVec.y, tmpVec.z);

        ///ТЕСТОВАЯ ПРОВЕРКА Z=-100;
        //конеч координаты луча
        Vector4f tmpVec1 = new Vector4f();
        tmpVec1.set(x, y, -100, 1.0f);
        tmpVec1.mul(invProjectionMatrix);
        tmpVec1.z =-100f;
        tmpVec1.w = 0.0f;
        tmpVec1.mul(invViewMatrix);
        Vector3f mouseDir2 = new Vector3f();
        mouseDir2.set(tmpVec1.x, tmpVec1.y, tmpVec1.z);
        System.out.println();
        return mouseDir1;
    }
26
Bug Reports / RFE / Re: [BUG] Geometry Shader
« Last post by elhant1 on May 14, 2018, 14:03:33 »
Thank you ! Sorry for the silly question.
I just changed my version and it is working fine.
27
Bug Reports / RFE / Re: [BUG] Geometry Shader
« Last post by KaiHH on May 14, 2018, 13:10:39 »
Please have a look at: https://www.khronos.org/opengl/wiki/Geometry_Shader
Geometry Shaders have been introduced in OpenGL 3.2.
28
Bug Reports / RFE / [CLOSED] Geometry Shader
« Last post by elhant1 on May 14, 2018, 12:48:32 »
Hello,

I use lwjgl 2.9.3. My OpenGl version is  3.0 Mesa 17.0.3, on a linux computer.

And I can't create a geometry shader, contrary to other shaders.

glCreateShader(GL_GEOMETRY_SHADER) returns always 0.

Example:
Code: [Select]

            Display.setDisplayMode(new DisplayMode(Settings.width,Settings.height));
            Display.setTitle("3D");
            Display.create(new PixelFormat().withSamples(Settings.antialiasing)); //Mutli-sampling.
            System.out.println("OpenGL version: " + glGetString(GL_VERSION));
            System.out.println("Geometry "+glCreateShader(GL_GEOMETRY_SHADER));
            System.out.println("Fragment "+glCreateShader(GL_FRAGMENT_SHADER));

Results :
Quote
OpenGL version: 3.0 Mesa 17.0.3
Geometry 0
Fragment 1


Could you help me ?

Thank you.
29
Bug Reports / RFE / Re: [BUG] Assimp so loading on Linux does not work
« Last post by spasi on May 14, 2018, 08:30:09 »
Actually, you don't have to wait for the next snapshot. You can download the updated Assimp from the LWJGL build browser (navigate to /nightly/linux/x64/ and click on Download next to libassimp.so). Use -Dorg.lwjgl.assimp.libname=<path_to_libassimp.so> to make sure the new binary is used by LWJGL.
30
Bug Reports / RFE / Re: [BUG] Assimp so loading on Linux does not work
« Last post by mudlee on May 14, 2018, 08:27:25 »
Okay, reply here when the snapshot is available and I'll try it out. CentOS is not a bleeding edge OS I agree, but at least it does not die every month :)
Pages: 1 2 [3] 4 5 ... 10