Java-Gaming.org
Java4K - to go         Javadoc:
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, peek at the official java tutorials or join us at irc #jgo.
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  java, gpu and the web  (Read 1533 times)
0 Members and 1 Guest are viewing this topic.
Offline pobrien11

JGO n00b
*

Posts: 4



« on: 2010-03-01 20:19:04 »

Hi,

    My question basically deals with the best approach to doing a fluid sim on the web using the GPU so that web users can interact with it. I currently have a fluid sim running on the gpu using openGL and GLSL. Its a multi pass approach using framebuffers to capture data from the GPU and feed it into the next pass as input. I have been doing some research, and have read about jogl, javaCL, processing, and webGL. I'm looking for some guidance on what would be the best approach (mostly in terms of performance). I need to be able to use the gpu for acceleration purposes, and it would be great to be able to leverage some of my existing code. My concern with webGL is it is so new and is only in preview builds of browsers. I tried using processing, but there aren't many resources out there for getting help. I appreciate any responses. Thanks,

Patrick
Offline Momoko_Fan

Full Member
**

Posts: 100
Medals: 3



« Reply #1 on: 2010-03-02 10:07:30 »

Whats the problem with just using Java + OpenGL (with either LWJGL or JOGL as binding)? Most people have java, and all the user has to do is to accept a confirmation dialog. WebGL is still somewhat of a prototype rather than a functional product, so I would not recommend using it.
From my experience Java is the best platform on the web for hardware accelerated 3D.
Offline gouessej

JGO Kernel
*****

Posts: 3433
Medals: 26


TUER


« Reply #2 on: 2010-03-02 10:17:17 »

bienator may answer you... Use JOGL and JOCL, it works just fine, you should have a look at Michael's demos.

http://github.com/mbien/jocl

Julien Gouesse
Games published by our own members! Go get 'em!
Offline pobrien11

JGO n00b
*

Posts: 4



« Reply #3 on: 2010-03-02 11:18:21 »

ok cool, i'll do that, thanks!
Offline bienator

JGO Ninja
***

Posts: 632
Medals: 1


OutOfCoffeeException


« Reply #4 on: 2010-03-02 12:50:41 »

not so fast Wink web + OpenCL is currently a bit risky. Drivers are not yet very stable especially if you want buffer sharing with GL.

At the end it really depends what you want to do if you say "fluid sim".
2D? use plain java and a handfull threads.
3D+focusing on pseudo-realistic graphical effects? OpenGL + GLSL (maybe OpenCL if you want to be cool, look at Apples demos)
3D+physical simulation of fluids, forget anything webgl except you want to render on the server Wink
realtime or not...?

Offline JL235

JGO Ninja
***

Posts: 660
Medals: 21



« Reply #5 on: 2010-03-02 15:39:09 »

There are also no plans for WebGL to be implemented in IE, and it's only supported in the nightly builds of FireFox, Chrome and Safari. If you use WebGL then practically no one will be able to run your app.


Offline pobrien11

JGO n00b
*

Posts: 4



« Reply #6 on: 2010-03-03 00:03:24 »

Hi bienator,

    I will be doing 2d. I'm using the lattice boltzmann method which scales well on the gpu. What do you guys think of wljgl? My concern with threads is it won't allow the parallel processing that the gpu does.
Offline bienator

JGO Ninja
***

Posts: 632
Medals: 1


OutOfCoffeeException


« Reply #7 on: 2010-03-03 05:24:22 »

you can use LWJGL for the job too. Both JOGL and LWJGL expose GLSL. And shaders are the parallelization vehicle what you are asking for. Although there were initially designed for graphics exclusively, they are sometimes abused for general purpose algorithms (esp. before CUDA, OpenCL etc. was available).

Offline Roquen

JGO Ninja
***

Posts: 578
Medals: 17



« Reply #8 on: 2010-03-03 05:40:53 »

Also, more people will be able to run a shader version than OpenCL, et al.  As an example, on one of my machines I've a DX10 Nvidia card, update-to-date drivers and Nvidia's OpenCL...it no worky.
Offline Momoko_Fan

Full Member
**

Posts: 100
Medals: 3



« Reply #9 on: 2010-03-03 09:25:35 »

Right now OpenCL probably won't work on many machines, since it requires specialized drivers and/or modifications.
See this page: http://www.geeks3d.com/20091221/how-to-enable-opencl-support-on-nvidia-and-amd-platforms/
I do not recommend relying heavily on OpenCL unless it becomes standard across all machines and gpus.
Games published by our own members! Go get 'em!
Offline pobrien11

JGO n00b
*

Posts: 4



« Reply #10 on: 2010-03-07 12:15:29 »

thanks for all the info, I'm trying out lwjgl
Offline gouessej

JGO Kernel
*****

Posts: 3433
Medals: 26


TUER


« Reply #11 on: 2010-03-08 04:26:39 »

thanks for all the info, I'm trying out lwjgl
Why not giving a try with JOGL?  Huh LWJGL has no interoperabily with OpenCL as far as I know.

Julien Gouesse
Offline princec
« League of Dukes »

JGO Kernel
*****

Posts: 7803
Medals: 77


Eh? Who? What? ... Me?


« Reply #12 on: 2010-03-08 04:51:35 »

Er, how can it not interoperate?

Cas Smiley

Offline gouessej

JGO Kernel
*****

Posts: 3433
Medals: 26


TUER


« Reply #13 on: 2010-03-08 08:37:57 »

Er, how can it not interoperate?

Cas Smiley
I was thinking about this :
1  
2  
3  
4  
/**
     * The cl_mem that has the contents of the VBO
     */

    private cl_mem vboMem;


1  
2  
3  
4  
// Create the vertex buffer object
       int buffer[] = new int[1];
        gl.glGenBuffers(1, IntBuffer.wrap(buffer));
        vertexBufferObject = buffer[0];


1  
2  
3  
4  
5  
6  
if (GL_INTEROP)
        {
            // Create OpenCL buffer from GL VBO
           vboMem = clCreateFromGLBuffer(context, CL_MEM_WRITE_ONLY,
                vertexBufferObject, null);
        }


but finally, you're right, it uses plain OpenGL, it should work with LWJGL too.

Julien Gouesse
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.162 seconds with 20 queries.