LWJGL Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2] 3 4 ... 10
 11 
 on: March 14, 2017, 14:45:00 
Started by devil0150 - Last post by devil0150
Hello,

I'm looking for a library to develop web games, and I'm considering LWJGL. Can games built with LWJGL run on the web? All information I could find is pretty old, 2013 or earlier.

Thanks.

 12 
 on: March 14, 2017, 14:12:05 
Started by rtmsoft - Last post by darkyellow
Here is some old code i had which loaded DDS textures

Code: [Select]
        int width = dds.getHeader().getWidth();
        int height = dds.getHeader().getHeight();
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_FALSE);
        int mipMapCount = (dds.getHeader().getFlags() & dds.getHeader().DDSD_MIPMAPCOUNT) != 0 ? dds.getHeader().getMipMapCount() : 1;
        GL11.glTexParameteri (GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, mipMapCount-1);
        ByteBuffer data = BufferUtils.createByteBuffer(dds.getHeader().getData().length);
        data.put(dds.getHeader().getData());
        data.rewind();
        if (compressed)
        {
            for (int i = 0; i < mipMapCount; ++i)
            {                               
                int size = (Math.max(divSize, width) / divSize) * (Math.max(divSize, height) / divSize) * blockBytes;
                ByteBuffer mipMapData = BufferUtils.createByteBuffer(size);
                byte[] mipMapByte = new byte[size];
                data.get(mipMapByte);
                mipMapData.put(mipMapByte);
                mipMapData.rewind();
                GL13.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, i, internalFormat, width, height, 0, mipMapData);
                width >>= 1;
                height >>= 1;

            }
        }

 13 
 on: March 14, 2017, 08:17:59 
Started by rtmsoft - Last post by rtmsoft
found http://forum.lwjgl.org/index.php?topic=1264.msg8394#msg8394
API GL13.glCompressedTexImage2D is changed.Trying to change parameter such as
Code: [Select]
GL13.glCompressedTexImage2D(GL11.GL_TEXTURE_2D,0,dxtFormat,ddsDesc2.width,ddsDesc2.height,ddsDesc2.pitchOrLinearSize,imageData);
or
Code: [Select]
GL13.glCompressedTexImage2D(GL11.GL_TEXTURE_2D,0,dxtFormat,ddsDesc2.width,ddsDesc2.height,0,imageData);
It draws a black area on my lwjgl display,how to do it now?

 14 
 on: March 13, 2017, 08:55:03 
Started by guatto - Last post by guatto
I modified my Matrix4f as you told me but now nothing appears, even if I remove the transformation matrix :

Code: [Select]
            matrix.m00 = 2.0f / (right - left);
    matrix.m01 = 0;
    matrix.m02 = 0;
    matrix.m03 = 0;
   
    matrix.m10 = 0;
    matrix.m11 = 2.0f / (top - bottom);
    matrix.m12 = 0;
    matrix.m13 = 0;
   
    matrix.m20 = 0;
    matrix.m21 = 0;
    matrix.m22 = -2.0f / (far - near);
    matrix.m23 = 0;
   
    matrix.m30 = -(right+left)/(right-left);
    matrix.m31 = -(top+bottom)/(top-bottom);
    matrix.m32 = -(far+near)/(far-near);
    matrix.m33 = 1;

I entered the following coordinates for the parameters:

Code: [Select]
  //left      right   bottom    top     near   far
    (0.0f,   800,    600,       0.0f,   0.0f,   1.0f)

 15 
 on: March 12, 2017, 23:38:43 
Started by guatto - Last post by Kai
In Matrix4f.mXY the X is the column index!

 16 
 on: March 12, 2017, 23:03:40 
Started by guatto - Last post by guatto
I followed the link you gave me and I tried to create an orthographic projection but the result is disappointing, my project contains multiple classes so I uploaded it to a host if you want to help me, thank you !

https://drive.google.com/file/d/0B_GWyJmcwrpYeGdaQ0dZZnpKZms/view?usp=sharing

 17 
 on: March 12, 2017, 18:21:09 
Started by guatto - Last post by Kai
Please do read the "Orthographic Projection" section of that article.

 18 
 on: March 12, 2017, 18:16:35 
Started by guatto - Last post by guatto
First thank you for your answers, concerning my previous problem it was about the Orthogonal projection that's why I remove it, can you just tell me what formula should I follow, I am still a beginner , thanks again !

 19 
 on: March 12, 2017, 17:57:36 
Started by guatto - Last post by Kai
You were already given an answer in your previous post, which you deleted.
The answer was: http://www.songho.ca/opengl/gl_projectionmatrix.html

 20 
 on: March 12, 2017, 17:48:11 
Started by guatto - Last post by guatto
let's say that my screen is (800 * 600) and i have a Quad (2D) drawn with the following vertices positions using Triangle_Strip (in NDC) :

Code: [Select]
float[] vertices = {-0.2f,0.2f,-0.2f,-0.2f,0.2f,0.2f,0.2f,-0.2f};
And I set up my Transformation Matrix in this way :

Code: [Select]
Matrix4f tranMatrix = new Matrix4f();
tranMatrix.setIdentity();
Matrix4f.translate(position, tranMatrix, tranMatrix);
Matrix4f.scale(new Vector3f(size.x, size.y, 1f), tranMatrix, tranMatrix);

And my vertex Shader :

Code: [Select]
#version 150 core
 
in vec2 in_Position;
 
uniform mat4 transMatrix;
 
void main(void) {
 
    gl_Position = transMatrix * vec4(in_Position,0,1.0);
 
}

My question is, which formula should I use to modify the transformations of my quad with coordinates (in Pixels) ?

For example :
-set scale (50px width, 50px height)  => NDC Vector2f(width,height)
-set position (100px posX, 100px posY) => NDC Vector2f(x,y)

To better understand, I would create a function to convert my Pixels data to NDCs to send them next to the shader. Thank you !

Pages: 1 [2] 3 4 ... 10