fenfire-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fenfire-dev] Lwjgl port status report


From: Matti Katila
Subject: [Fenfire-dev] Lwjgl port status report
Date: Tue, 7 Mar 2006 01:00:19 +0200 (EET)


Hello,

I have been working on lwjgl port of libvob.
Porting of C++ code isn't that fast but I'm going forward with it.
I have also understood how much C++ code we actually have. It's quite big
part of libvob and thus fenfire.

The biggest problem is basically that libvob is not designed to work with
another OpenGL implementation expect native one. My first goal was to keep
source compatibility; most of source files are jython files that use
current OpenGL interface. But I run into problems since the layer to
native side is thin and everything is so static - literally.
libvob.gl.GL.java and libvob.gl.GLRen.java are some of those classes
which raised problems and these classes form the OpenGL interface of
libvob.

So, I created another abstraction layer for GLRen called Ren. This class
has just tag interfaces to different OpenGL implementations and
methods that delegates (multiplexes) to different ports of OpenGL.
For GL.java I have used a approach given by Tuukka, i.e., there's
interface for calls and there's implementation inside of GL.java which
delegates calls.


How to get anything rendered?
=============================

Tuukka asked how to get anything rendered on screen with lwjgl port.
I use a class called SimpleTest which can be found in package
org.nongnu.libvob.impl.lwjgl.

If you are using Eclipse as I do, remember to give VM arguments
something close to this:

-Dvob.windowsize=300x400
-Dvob.api=lwjgl
-Djava.library.path=../depends
-DLWJGL_DISABLE_XRANDR=false
-Dpython.path=../depends/jythonlib.jar:../depends/pythonlib.jar

Another problem that I fall down was that lwjgl needs Java 1.5 with
the java archives found in depends directory (there's a bug which is
fixed already in CVS of lwjgl).

Also this works if you are interested to test with Lobs:

 libvob$ JAVA=/usr/local/jdk1.5.0_06/bin/java make run_puzzle
DBG="-Dvob.api=lwjgl -Djava.library.path=../depends"


What is expected to work is some easy vobs which use CallGL. That was the
first thing I ported (thus it has java.nio.Buffer problems that I tell
more on later). Also my simplified mosaic text should work after I commit
the generated texture files (anyway, I have a bunch of new files waiting
to be recorded into darcs).


How can I help in porting?
==========================

Yeah, sure you can help in porting. There's currently trivial vobs that
should be straigforward to implement, i.e., create
org.nongnu.libvob.gl.impl.lwjgl.FooVob.java and then read C++ header file
from include/vob/vobs/Trivial.hxx and implement vob Foo.
Then make it so that Ren.createFoo() --calls--> LWJGLRen().createFoo,
Ren.createFoo should return a new instance or GLRen.createFoo if lwjgl is
not available. There's few example sources already ported in the same
package already. If you have all those vobs ported you can port also
other vobs, e.g., Fillet.hxx, GLState.hxx, Irregu.hxx, Lines.hxx,
Paper.hxx, Pixel.hxx, Program.hxx, Text.hxx or Texture.hxx.

Second thing is coordinate systems. These are fun too. Just start from
include/vob/trans/*.hxx. Try to keep the package order equivalent with
native side, e.g., include/vob/trans/LinearPrimitives will go into package
org.nongnu.libvob.gl.impl.lwjgl.trans.linear.

Third thing is textures. These are generated as well as anything else in
native libvob ;-)  Look at files in src/texture/*.texture.

Fourth, a very simple task is to implement event binding. This can be
found in LWJGLUpdateManager where it has a stub already in place.

Fifth, animation support is not yet implemented even it is easy to do.
src/trans/Coorder.cxx and in Java libvob.gl.impl.lwjgl.LwjglCoorder.

Then there's tips and tricks. Lwjgl uses java.nio for pushing bits trough
jni. Use BufferUtil.create[Float, Integer, Byte]Buffer or your buffer will
probably be in wrong endian format. Also, remember to buff.flip() your
buffer before calling OpenGL.

I try to record and commit my bits tonight so you can start wondering some
source code.


   -Matti




reply via email to

[Prev in Thread] Current Thread [Next in Thread]