LWJGL Forum

Please login or register.

Login with username, password and session length
Pages: [1] 2 3 ... 10
 1 
 on: Today at 13:54:40 
Started by GriffinBabe - Last post by spasi
ImageIO initializes AWT. The problem is that the GLFW and AWT event loops cannot run at the same time in the main/first thread on macOS. See this thread for more information. The simplest solution is to replace ImageIO with STBImage.

 2 
 on: Today at 12:31:33 
Started by GriffinBabe - Last post by GriffinBabe
Hello,

When I try to load a texture my program blocks at the ImageIO.read(file) method, placed in my Texture class constructor, the program blocks. There is no crash and no printStackTrace. It's like if I am locked in a while loop.

I tried to construct the texture in different places in my code, and it seems to not work only after I create a window with glfwCreateWindow(sizeX,sizeY,"name",0,0).
I'm on mac os Sierra, if that can help...

This clearly isn't a file access problem, if you wonder.

Code: [Select]
public Window(int sizeX, int sizeY,Game game) {
this.game = game;
this.frame = 0;

if (!glfwInit()) {
throw new IllegalStateException("GLFW failed to initialize.");
}
Texture texture1 = new Texture("brick.png"); //Here it works
window = glfwCreateWindow(sizeX,sizeY,"Game3Graphics",0,0);

if (window == 0) {
throw new IllegalStateException("Failed to create window.");
}

glfwShowWindow(window);

glfwMakeContextCurrent(window);

GL.createCapabilities();

glEnable(GL_TEXTURE_2D);

Texture texture2 = new Texture("brick.png"); //Here it locks you in ImageIO.read()
}

My texture class

Code: [Select]
public Texture(String fileName) {
BufferedImage bi;

try {
bi = ImageIO.read(new File(fileName));

width = bi.getWidth();
height = bi.getHeight();

int[] pixelsRaw = new int[width * height];

pixelsRaw = bi.getRGB(0, 0, width, height, null, 0, width);

ByteBuffer pixels = BufferUtils.createByteBuffer(width * height * 4);

for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int pixel = pixelsRaw[i * width + j];
pixels.put((byte) ((pixel >> 16) & 0xFF));// RED
pixels.put((byte) ((pixel >> 8) & 0xFF));// GREEN
pixels.put((byte) ((pixel) & 0xFF));// BLUE
pixels.put((byte) ((pixel >> 24) & 0xFF));// ALPHA
}
}

pixels.flip();

tex_id = glGenTextures();

//We put parameters.
glBindTexture(GL_TEXTURE_2D,tex_id);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width,height, 0,GL_RGBA,GL_UNSIGNED_BYTE,pixels);

} catch (Exception e) {
e.printStackTrace();
}
}

Thank you

 3 
 on: Today at 11:49:13 
Started by Lightbuffer - Last post by Lightbuffer
Hello there!

LWJGL3 tutorials are cool and quite educational, but it's very difficult to apply them on practice. I have a quite hard time grasping those concepts and putting them together, since there's a lot of stuff going on. Meanwhile a video game written in LWJGL3 with source code and ability to tweak and compile will help to advance and see how these techniques and stuff is applied.

Are there any simple (2d or 3d) video games which are written in LWJGL3 and are open-sourced?

Thanks for attention! :)

 4 
 on: May 26, 2017, 19:22:44 
Started by officialhopsof - Last post by Evan407
You can find a description of the parameters in the javadoc or in the OpenCL Reference Page for clCreateContext.

Btw, I just tried your program (with the #define) and it builds without errors.
I haven't been able to test it with more than a single device. My pc only has one graphics card but my aim was to retrieve all the devices in the nature of OpenCL. I intend to use OpenCL for some image processing applications to drastically increase the speed of my iterations.

So far I've found out openCL has a pointless Work Group with the important work items which are kernel instances that are called on like functions or methods. I think there may be some hierarchy redundancy there.

The point is that there is Global and Constant memory defined by the host and then there is openCL kernel that runs off this memory using memory commands. You have to fill the buffers with the global and constant memory and then run kernel. After you can unmap a region of a memory object aka retrieve the computed results. Explicitly copying data / mapping and unmaping regions of a memory object.

Create memory objects in global memory, enqueue memory commands. Kernel execution commands.

 5 
 on: May 26, 2017, 13:59:08 
Started by jrdan - Last post by darkyellow
In what way is this a lwjgl issue?  You are asking a question about getting the context from another process which is neither lwjgl nor GLFW relevant. I'm not trying to be nasty to you but there might be better places to ask this question (best location is unknown to me though)

 6 
 on: May 26, 2017, 06:23:04 
Started by jrdan - Last post by jrdan
no one can fix this issue´╝č

 7 
 on: May 25, 2017, 18:35:05 
Started by officialhopsof - Last post by spasi
You can find a description of the parameters in the javadoc or in the OpenCL Reference Page for clCreateContext.

Btw, I just tried your program (with the #define) and it builds without errors.

 8 
 on: May 25, 2017, 17:26:03 
Started by officialhopsof - Last post by Evan407
I haven't gotten there yet but here is what I run
java -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugLoader=true -cp Dependencies/lwjgl/*:. com.evanstools.opencl.demo.Demo
it provides more error reporting.

I'm able to create a context for each platform. I'm trying to retrieve all devices.
http://evansgame.com/com/evanstools/opencl/demo/Platform.java

There are error callbacks too that help. I'm still trying to find out how to use the parameters of
Quote
invoke(long errinfo, long private_info, long cb, long user_data)

They are long data types I'm assuming ... pointers. I've been referring them to as id like a memory id or reference type or pointers. Basically all the longs are pointers.

 9 
 on: May 24, 2017, 21:44:03 
Started by officialhopsof - Last post by spasi
There's nothing unusual about OpenCL in LWJGL. Inspect the CL_PROGRAM_BUILD_LOG to see what the problem is.

 10 
 on: May 24, 2017, 20:40:06 
Started by Evan407 - Last post by Evan407
this solved it
Code: [Select]
sudo apt install nvidia-opencl-icd-375
Quote
"Number of platforms: 1"

Pages: [1] 2 3 ... 10