LWJGL Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2] 3 4 ... 10
 11 
 on: May 22, 2017, 09:25:29 
Started by CJBurkey - Last post by yoojeen
2Zin: Your demo made for LWJGL3?

import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;

is disabled and not work.

LWJGL3 haven't org.lwjgl.util.vector package

i got vector folder with classes from lwjgl2.9.1, and... nothing!



isn't work


 12 
 on: May 22, 2017, 08:44:28 
Started by hexatronic - Last post by hexatronic
Good ideas, thanks for your help.

 13 
 on: May 22, 2017, 08:36:21 
Started by smokethepot - Last post by yoojeen
Mac OS?
Not only slick textures isn't work. On a Mac OS lwjgl3-tutorial by SilverTiger is not work too. Just black screen.

can't initialized textured fonts in a Fonts class
https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Fonts
seems, any texture loader isn't work
for this reason i can't get to use lwjgl since the beginning of the third version

 14 
 on: May 22, 2017, 07:07:09 
Started by hexatronic - Last post by spasi
A few thoughts:

- This sounds like a bug in Apple's OpenCL implementation.
- If the GPU device is inactive, then it is should not be listed as available in OpenCL.
- If the GPU device can be used for compute, but cannot be used for graphics interop, then it should be listed as available in OpenCL, but without the *_gl_* extensions.
- An application should indeed try the "best" available device and fallback to other device(s) if that one fails. "Best" means whatever is appropriate for the particular application, based on the exposed capabilities and characteristics of the device.
- Another thing you could try is: create a hidden/temporary GLFW window and query the GPU vendor of the created context. Use that vendor to select the corresponding OpenCL device.

 15 
 on: May 21, 2017, 21:49:25 
Started by hexatronic - Last post by hexatronic
Yes that worked.

I added this into the loop part of getDevice:

            String vendor = getDeviceInfoStringUTF8(device, CL_DEVICE_VENDOR);
            if(deviceType == CL_DEVICE_TYPE_GPU && !vendor.equals("NVIDIA")) {
               continue;
            }


In production I am guessing you would loop over the various GPUs which the host machine reported and try them in turn?

I am pretty sure the Intel Iris GPU is also perfectly capable of OpenCL / GL interop, it's just not working in my case because that GPU is not active.

Unless there's some way that the operating system can report which one is "active"?

 16 
 on: May 21, 2017, 19:12:48 
Started by hexatronic - Last post by spasi
Hey hexatronic,

Looks like it's simply a problem of the demo code that chooses OpenCL devices. I have tried it with multiple platforms/devices, but haven't seen 3 devices on the same platform. The demo currently always chooses the first two devices with OpenGL interop support, which happen to be the Intel CPU and the Intel GPU on your system. The code that chooses a device based on type is in the getDevice method, at Mandelbrot.java:462. It should be easy to change to make it choose the Nvidia device.

Modifying the demo so that it shows 3 windows with all 3 devices should also be possible, but probably harder.

 17 
 on: May 21, 2017, 18:32:57 
Started by hexatronic - Last post by hexatronic
Hi,

I'm trying to run the CL/GL interop demo on a MacBook Pro, based on LWJGL 3.1.1

As far as I can tell this tries to run the Mandelbrot computation / display on both the GPU and CPU if available.

The CPU side works, for the GPU I'm getting this:

[Apple - GPU] cl_context_callback
   Info: [CL_INVALID_DEVICE] : OpenCL Error : clCreateCommandQueue failed: Unable to locate device 0x1024500 in context 0x7fcb78e658a0.


My system details:
MacBook Pro (Retina, 15-inch, Mid 2014)
OSX Yosemite 10.10.1

The discrete GPU on my system is NVIDIA GeForce GT 750M 2048 MB.
But, I think it also has an integrated GPU which is the Intel Iris Pro. The demo seems to be trying to set up on the Iris, based on the ID mentioned in the error.

Just a hunch but I am wondering if confusion between which GPU is active might be the source of the problem.

The output of CLDemo, with all the info, is below.

Any idea how to move this forward?



-------------------------
NEW PLATFORM: [0x7FFF0000]
   CL_PLATFORM_PROFILE = FULL_PROFILE
   CL_PLATFORM_VERSION = OpenCL 1.2 (Sep 20 2014 22:01:02)
   CL_PLATFORM_NAME = Apple
   CL_PLATFORM_VENDOR = Apple
   CL_PLATFORM_EXTENSIONS = cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event


   ** NEW DEVICE: [0xFFFFFFFF]
   CL_DEVICE_TYPE = 2
   CL_DEVICE_VENDOR_ID = -1
   CL_DEVICE_MAX_COMPUTE_UNITS = 8
   CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
   CL_DEVICE_MAX_WORK_GROUP_SIZE = 1024
   CL_DEVICE_MAX_CLOCK_FREQUENCY = 2500
   CL_DEVICE_ADDRESS_BITS = 64
   CL_DEVICE_AVAILABLE = true
   CL_DEVICE_COMPILER_AVAILABLE = true
   CL_DEVICE_NAME = Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
   CL_DEVICE_VENDOR = Intel
   CL_DRIVER_VERSION = 1.1
   CL_DEVICE_PROFILE = FULL_PROFILE
   CL_DEVICE_VERSION = OpenCL 1.2
   CL_DEVICE_EXTENSIONS = cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_APPLE_fp64_basic_ops cl_APPLE_fixed_alpha_channel_orders cl_APPLE_biased_fixed_point_image_formats cl_APPLE_command_queue_priority
   CL_DEVICE_OPENCL_C_VERSION = OpenCL C 1.2
      -TRYING TO EXEC NATIVE KERNEL-
      KERNEL EXEC argument: 1337, should be 1337
      Event callback status: CL_COMPLETE

      EMPTY NATIVE KERNEL AVG EXEC TIME: 13.6670us

      Sub Buffer destructed: 140654185474272
      Buffer destructed (2): 140654188521344
      Buffer destructed (1): 140654188521344

   ** NEW DEVICE: [0x1024500]
   CL_DEVICE_TYPE = 4
   CL_DEVICE_VENDOR_ID = 16925952
   CL_DEVICE_MAX_COMPUTE_UNITS = 40
   CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
   CL_DEVICE_MAX_WORK_GROUP_SIZE = 512
   CL_DEVICE_MAX_CLOCK_FREQUENCY = 1200
   CL_DEVICE_ADDRESS_BITS = 64
   CL_DEVICE_AVAILABLE = true
   CL_DEVICE_COMPILER_AVAILABLE = true
   CL_DEVICE_NAME = Iris Pro
   CL_DEVICE_VENDOR = Intel
   CL_DRIVER_VERSION = 1.2(Sep 25 2014 22:25:51)
   CL_DEVICE_PROFILE = FULL_PROFILE
   CL_DEVICE_VERSION = OpenCL 1.2
   CL_DEVICE_EXTENSIONS = cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_image2d_from_buffer cl_khr_gl_depth_images cl_khr_depth_images cl_khr_3d_image_writes cl_khr_gl_msaa_sharing
   CL_DEVICE_OPENCL_C_VERSION = OpenCL C 1.2

      Sub Buffer destructed: 140654185575952
      Buffer destructed (2): 140654185474656
      Buffer destructed (1): 140654185474656

   ** NEW DEVICE: [0x1022700]
   CL_DEVICE_TYPE = 4
   CL_DEVICE_VENDOR_ID = 16918272
   CL_DEVICE_MAX_COMPUTE_UNITS = 2
   CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
   CL_DEVICE_MAX_WORK_GROUP_SIZE = 1024
   CL_DEVICE_MAX_CLOCK_FREQUENCY = 925
   CL_DEVICE_ADDRESS_BITS = 32
   CL_DEVICE_AVAILABLE = true
   CL_DEVICE_COMPILER_AVAILABLE = true
   CL_DEVICE_NAME = GeForce GT 750M
   CL_DEVICE_VENDOR = NVIDIA
   CL_DRIVER_VERSION = 10.0.43 310.41.05f01
   CL_DEVICE_PROFILE = FULL_PROFILE
   CL_DEVICE_VERSION = OpenCL 1.2
   CL_DEVICE_EXTENSIONS = cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_APPLE_fp64_basic_ops cl_khr_fp64 cl_khr_3d_image_writes cl_khr_depth_images cl_khr_gl_depth_images cl_khr_gl_msaa_sharing cl_khr_image2d_from_buffer cl_APPLE_ycbcr_422 cl_APPLE_rgb_422
   CL_DEVICE_OPENCL_C_VERSION = OpenCL C 1.2

      Sub Buffer destructed: 140654187450480
      Buffer destructed (2): 140654187449776
      Buffer destructed (1): 140654187449776




 18 
 on: May 21, 2017, 00:08:06 
Started by CJBurkey - Last post by Zin
You can check out my code and try to render it that way or just use my engine here: https://github.com/HydraulicHydrox/ZE1

 19 
 on: May 20, 2017, 23:29:10 
Started by Zin - Last post by Zin
Hi, im wondering how to do sunshine effects or light tunnel or lens flare, or sparkle whatever here is an example if you dont understand i tried to find a tutorial on it but i couldn't find one.

 20 
 on: May 20, 2017, 14:06:52 
Started by CJBurkey - Last post by CJBurkey
I don't know if this is something on my end, but I've Googled this issue for two days now and tried various solutions, none of which worked. The issue is that I cannot get even a simple triangle to render. I have shaders set up and all that fun stuff. The entire project is on https://github.com/cjburkey01/Angulus, but here's the shader and render classes:

Vertex Shader:
Code: [Select]
#version 330

layout(location = 0) in vec3 position;

void main() {
gl_Position = vec4(position, 1.0);
}

Fragment Shader:
Code: [Select]
#version 330

out vec4 fragColor;
void main() {
fragColor = vec4(1.0, 1.0, 1.0, 1.0);
}

Shader Loader:
Code: [Select]
private int program;

public Shader() {
program = GL20.glCreateProgram();
if(program == 0) {
Angulus.instance.getLogger().log("Couldn't create shader program.");
Angulus.instance.kill();
return;
}
}

public abstract void bindAttributes();

protected void bindAttribute(int attrib, String varName) {
GL20.glBindAttribLocation(program, attrib, varName);
Angulus.instance.getLogger().log("Bound attrib: " + varName);
}

public void bind() {
GL20.glUseProgram(program);
}

public static void unbind() {
GL20.glUseProgram(0);
}

protected void addVertShader(String txt) {
addProgram(txt, GL20.GL_VERTEX_SHADER);
}

protected void addFragShader(String txt) {
addProgram(txt, GL20.GL_FRAGMENT_SHADER);
}

protected void compileProgram() {
GL20.glLinkProgram(program);
if(GL20.glGetProgrami(program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) {
Angulus.instance.getLogger().log("Couldn't link shader program.");
Angulus.instance.kill();
return;
}
/*GL20.glValidateProgram(program);
if(GL20.glGetProgrami(program, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) {
Angulus.instance.getLogger().log("Couldn't validate shader program.");
Angulus.instance.getLogger().log(GL20.glGetProgramInfoLog(program, 1024));
Angulus.instance.kill();
return;
}*/

bindAttributes();
}

private void addProgram(String txt, int type) {
int shader = GL20.glCreateShader(type);
if(shader == 0) {
Angulus.instance.getLogger().log("Couldn't create shader.");
Angulus.instance.kill();
return;
}
GL20.glShaderSource(shader, txt);
GL20.glCompileShader(shader);
if(GL20.glGetShaderi(shader, GL20.GL_COMPILE_STATUS) == 0) {
Angulus.instance.getLogger().log("Couldn't compile shader:");
Angulus.instance.getLogger().log("  " + GL20.glGetShaderInfoLog(shader, 1024));
Angulus.instance.kill();
return;
}
GL20.glAttachShader(program, shader);
}

public static String loadShader(String fName) {
StringBuilder src = new StringBuilder();
try {
BufferedReader r = new BufferedReader(new InputStreamReader(Shader.class.getResourceAsStream("/res/shader/" + fName)));
String l = "";
while((l = r.readLine()) != null) {
src.append(l);
src.append("\n");
}
r.close();
} catch(Exception e) {
e.printStackTrace();
}
return src.toString();
}

Renderer:
Code: [Select]
private BasicShader shader;
private Model m;

public Renderer() {
init();
shader = new BasicShader();
m = new Model();
Vertex[] v = {
new Vertex(-1, -1, 0),
new Vertex(1, -1, 0),
new Vertex(0, 1, 0),
};
m.bufferVertices(v);
}

public void render() {
prepare();

shader.bind();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, m.getVbo());
GL20.glEnableVertexAttribArray(0);
GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, Vertex.SIZE * 4, 0);
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, m.getSize());
GL20.glDisableVertexAttribArray(0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
Shader.unbind();
}

public void cleanup() {

}

private void prepare() {
GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}

private void init() {
GL11.glEnable(GL11.GL_DEPTH_TEST);
}

Model:
Code: [Select]
private int vbo;
private int size;

public Model() {
vbo = GL15.glGenBuffers();
size = 0;
}

public void bufferVertices(Vertex[] vertices) {
FloatBuffer buffer = BufferUtils.createFloatBuffer(vertices.length * Vertex.SIZE);
for(Vertex v : vertices) {
buffer.put(v.getX());
buffer.put(v.getY());
buffer.put(v.getZ());
}
buffer.flip();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
size = vertices.length;
}

public int getVbo() {
return vbo;
}

public int getSize() {
return size;
}

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