Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - raft

Pages: [1] 2 3 ... 8
Bones / Moved to GitHub
« on: July 19, 2020, 07:23:33 pm »
Source code of Bones moved to GitHub.

The latest downloadable zip file can be found at releases page.

Of course this doesnt mean, Bones is moving away from jPCT community. It's a library for jPCT after all :)

The primary feedback and question medium will still be jPCT forums as mentioned in the feedback section.

This was something I wanted to do since long time, to get rid of the burden of keeping the source code safe. Cloudforge, the previous host of Bones' code is closing, so this looked like the proper time to do that.

Egon, can you please update the links :)

Support / Texture.overrideTexelData
« on: October 01, 2014, 04:46:49 pm »
* I've noticed that, regardless of Texture is using alpha or not, Texture.overrideTexelData requires 4 bytes per pixel. is this intentional?

* Texture.overrideTexelData requires the given ByteBuffer must be direct and in LITTLE_ENDIAN order. however ByteBuffer.wrap(byte[])  returns an indirect BIG_ENDIAN buffer on my windows 8 machine. is this restriction necessary?

note: this post is intentionally on desktop jPCT board

Support / javadoc jar
« on: October 01, 2014, 01:02:02 pm »
when jpct.jar is placed in libs folder in Eclipse project, javadoc location is not editable. according to this post in stackoverflow, one workaround is to place javadoc.jar in a proper location and edit a special properties file. unfortunately this does not work for remote (http) javadocs.

so Egon can you please add javadoc.jar to downloads page. unless of course you know an alternative solution?

Support / strange crash related to external texture
« on: May 22, 2014, 01:34:18 pm »
i have a strange situation. i render video content to an external texture which is assigned to an Object3D (as mentioned in this thread).

i have an extra regular object in the scene which is added to world but invisible. if i make it visible after above external texture starts working, i got a crash as in the logs below.

if object is visible when external texture starts, then all is good. i can switch its visibility on and off without any problem.

what's more weirder is, i set glDebugLevel to 1 to collect some logs. but above problem never happened when logs are on.

both 3 cases are consistent behaviours, they happen all the time.

weird, huh? :o any ideas?

Code: [Select]
05-22 14:15:16.520: I/jPCT-AE(10446): Normal vectors calculated in 1ms!
05-22 14:15:16.575: I/jPCT-AE(10446): Subobject of object 3/object5 compiled to indexed fixed point data using 6/4 vertices in 1ms!
05-22 14:15:16.575: I/jPCT-AE(10446): Object 3/object5 compiled to 1 subobjects in 1ms!
05-22 14:15:16.575: I/jPCT-AE(10446): Compiling shader program!
05-22 14:15:16.610: I/jPCT-AE(10446): Handles of 33: 1/29/2
05-22 14:15:16.610: I/jPCT-AE(10446): Creating buffers...
05-22 14:15:16.610: I/jPCT-AE(10446): VBO created for object 'object5'
05-22 14:15:20.925: I/jPCT-AE(10446): Creating buffers...
05-22 14:15:20.925: I/jPCT-AE(10446): [ 1400757320932 ] - ERROR: before: glError 1282
05-22 14:15:20.950: W/dalvikvm(10446): threadid=11: thread exiting with uncaught exception (group=0x41ca5700)
05-22 14:15:20.955: E/AndroidRuntime(10446): FATAL EXCEPTION: GLThread 9050
05-22 14:15:20.955: E/AndroidRuntime(10446): java.lang.RuntimeException: [ 1400757320932 ] - ERROR: before: glError 1282
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.Logger.log(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.GL20.checkError(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.GL20.glGenBuffers(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.CompiledInstance.compileToVBO(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.CompiledInstance.render(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.GLRenderer.drawVertexArray(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.World.draw(
05-22 14:15:20.955: E/AndroidRuntime(10446): at com.threed.jpct.World.draw(
05-22 14:15:20.955: E/AndroidRuntime(10446): at$VideoPlaneView.render3D(
05-22 14:15:20.955: E/AndroidRuntime(10446): at$OpenGLRenderer.onDrawFrame(
05-22 14:15:20.955: E/AndroidRuntime(10446): at android.opengl.GLSurfaceView$GLThread.guardedRun(
05-22 14:15:20.955: E/AndroidRuntime(10446): at android.opengl.GLSurfaceView$

Support / rendering only to depth buffer
« on: February 18, 2014, 11:53:32 am »
is it possible to render an object only to depth buffer but not to frame buffer? i want to use this for a kind of masking.

here is my tunnel rendered on top of camera view:

same tunnel with a different camara orientation. obviously looks wrong since the deeper parts of the tunnel should not be actually visible.

if I understand the depth mask thing in unity correct, one way to resolve this issue is, place a plane on top of the tunnel with a hole in it (hole is the entry of the tunnel), render it to only depth buffer and then render the scene (tunnel).

like this, the yellow area will be masked:

is this possible?

Support / assign a GL texture to an Object3D
« on: January 23, 2014, 03:20:53 pm »
is it possible to assign an Object3D a GL texture which is created outside of jPCT?

with this code i can create a special texture to which i can redirect Android's Camera or MediaPlayer output, kind of render to texture. if i can assign that texture to an Object3d, i can play perspectively correct videos inside jPCT world.

is it possible?

Support / reversing camera space
« on: January 09, 2014, 09:52:07 pm »
I have a default camera at origin looking through z axis. I also have an object in camera's field of view with some rotation and translation. I want to place the object to origin with no transform (identity matrix) and place camera such that what camera sees was identical to before. how to do that?

I'm planning to take the object's world transform, invert it and set as back buffer to camera? not tried yet.

Support / blitting with rotation and perspective warp
« on: January 09, 2014, 09:23:21 am »
i want to blit an image with rotation and perspective warp, how can I do that?

OpenCv finds my template in camera image and it also gives me a 2d affine transform (3x3 matrix) to transform the borders of the template (it's a rectangle) to camera space. the white lines in the image reflects transformed template borders.

i want to blit an image to fit that distorted rectangle, how can I do that? is it possible to add such a blitting method to FrameBuffer? or what else can I do? going reverse and put a quad and calculate corner points of the quad based on fov and camera distance may also an option but seems complicated. i also want the result perspectively correct, i.e. there should be no discontinuity accross the diagonal line, i'm not sure quad solution will provide that.

any other suggestions?

Support / INioBufferTextureEffect
« on: January 03, 2014, 08:09:36 pm »
can I suggest adding a new version of ITextureEffect which accepts java.nio.Buffer and channel ordering?

I'm experimenting with the idea of mixing OpenCV with jPCT and making them to render to same GLSurfaceView as I mentioned in this thread. the pipeline is something like:

* take android's camera preview data (byte[]) and put into an OpenCV Mat1 object
* modify and/or process Mat via OpenCV
* copy final contents of Mat into a jPCT texture via an ITextureEffect
* blit that texture as background
* render 3d content over that

all is fine for now except the fps. some profiling suggests most of the time is spent in ITextureEffect.apply(..) method.

there are two issues:
* jPCT wants texture data in ARGB channel order but OpenCV supports RGBA and BGRA, not ARGB
* jPCT wants all channels embedded into an int but OpenCV gives chanels as different bytes (or float/short/int whatever depth is used)

so I take the byte array from OpenCV, iterate over that, re-arrange the bytes and create an int out of that. jPCT takes that and puts them into a nio.Buffer, quite a waste.

long story short, it may be good idea to add a new version of ITextureEffect which accepts java.nio.Buffer and channel ordering. unless of course there is a better way?

as an implementation detail, this new one can extend from the current ITextureEffect to keep things simple:

Code: [Select]
interface INioBufferTextureEffect extends ITextureEffect {
    // channel order maybe return type or a setting in Config.
    // if filling in source is costly, it can even be skipped based on a setting in Config
    void apply(java.nio.Buffer dest, java.nio.Buffer source);

1: Mat is an OpenCV matrix like structure which can hold and convert to a matrix of arbitrary depth. pixels of an image or a perspective transform for example.

Support / fast way to get contents of SurfaceTexture?
« on: December 19, 2013, 09:10:55 am »
does anybody now a fast way to get contents of a SurfaceTexture?

SurfaceTexture is a very convenient way to direct Android's Camera or MediaPlayer output to a texture in GLSurfaceView, kind of render to texture. But I also need the pixel data of the surface for further processing and the only way I found is via GLES20.glReadPixels which is infeasably slow. only getting pixels without any processing drops FPS to 4 on a Samsung S3.

Some information here: it says a SurfaceTexture is backed by an external texture and that's why its content can not be retrieved in regular ways.

Support / GLSurfaceView.setEGLContextClientVersion
« on: December 18, 2013, 12:40:58 pm »
adding this line to HelloWorld sample before setEGLConfigChooser

Code: [Select]
results in the exception below. any ideas how to fix this?

Code: [Select]
I/jPCT-AE (24633): Memory usage after compacting: 12335 KB used out of 13447 KB. Max. memory available to the VM is 65536 KB.
I/jPCT-AE (24633): Saving master Activity!
E/libEGL  (24633): called unimplemented OpenGL ES API
E/libEGL  (24633): called unimplemented OpenGL ES API
E/libEGL  (24633): called unimplemented OpenGL ES API
I/jPCT-AE (24633): [ 1387365972966 ] - WARNING: State: 0/0/0/0/0/0/0
W/dalvikvm(24633): threadid=11: thread exiting with uncaught exception (group=0x4199d2a0)
E/AndroidRuntime(24633): FATAL EXCEPTION: GLThread 7949
E/AndroidRuntime(24633): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
E/AndroidRuntime(24633):        at com.threed.jpct.CompiledInstance._fill(
E/AndroidRuntime(24633):        at com.threed.jpct.CompiledInstance.fill(
E/AndroidRuntime(24633):        at com.threed.jpct.Object3DCompiler.compile(
E/AndroidRuntime(24633):        at com.threed.jpct.World.compile(
E/AndroidRuntime(24633):        at com.threed.jpct.World.renderScene(
E/AndroidRuntime(24633):        at com.threed.jpct.example.HelloWorld$MyRenderer.onDrawFrame(
E/AndroidRuntime(24633):        at android.opengl.GLSurfaceView$GLThread.guardedRun(
E/AndroidRuntime(24633):        at android.opengl.GLSurfaceView$

Bones / Postvayler: Transparent Persistence for POJO's
« on: December 07, 2013, 10:06:27 pm »
this is neither jPCT nor Bones related but I guess it's worth mentioning. afterall, this is my board ;)

my new open source project has arrived to the 'Proof of Concept' state. personally I found it very handy and promising :)

all contributions and feedback are welcome.

r a f t

Support / colors on OUYA
« on: July 31, 2013, 09:19:55 am »
I've finally received my OUYA. here are first impressions:

It's a cute tiny box. I've known in prior that it's small in size but still it's surprising to see how small it is. slightly bigger then a rubic cube. the console and controller looks good but I suppose the material quality is not that good. battery housing covers tend to open themselves. after a few hours of play, one of the analogue sticks started to screak. I guess there is some extra weight in the controller which makes it fit hand better. the stick sensitivity feels good but that may change in time due to wearing.

anyway, about the subject: I've checked Sky Maze and found that colors look ugly. I dont know how to explain it, they just look unfamiliar and ugly. this does not result from TV settings since other games look good. I dont know the reason yet, maybe extra caution is required for texture colors for TV? (for example, in Android docs, it's suggested to avoid pure white (#FFFFFF) since it may cause vibrancy and image ghosting.)

high resolution (due to relatively small texture sizes) is not also the reason, since I've run desktop version of Sky Maze in my 1080p 24" monitor and never saw such an effect.

may this be relevant with EGLConfigChooser? here is my corresponding code:

Code: [Select]
glSurfaceView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];

any other ideas?

Support / multi-thread unsafe operations
« on: March 27, 2013, 01:45:26 pm »
Egon can you please briefly document what operations are or aren't safe for multi threading? for example rendering, displaying buffer and modifying an object/mesh which is in the rendered world obviously are not.

I'm pretty convinced that I'm sometimes having a multi-threading issue because of level loading at background. I basicly create a new world, load game objects from serialized data, attach vertex controllers and create particles. all of these are new instances. shadows are initialized later on in GL thread. no texture loading here either.

but I guess, one of these operations (or another one which I missed) is causing a multi-threading issue.

Support / exception in Object3D.rotateMesh on OUYA
« on: March 23, 2013, 06:04:49 pm »
this exception newer happens on my Nexus 7, my phone or desktop. two Ouya console owners reported this. and it does not always happen. but once happened, level loading fails until application is restarted, possibly because of same exception.

this code runs during level loading in a background thread.

Code: [Select]
java.lang.ArrayIndexOutOfBoundsException: length=11; index=11
  at com.threed.jpct.Vectors.addVertex(
  at com.threed.jpct.Object3D.setBoundingBox(
  at com.threed.jpct.Object3D.calcBoundingBox(
  at com.threed.jpct.Object3D.rotateMesh(
  at raft.jumpy.view.Particle.<init>(
  at raft.jumpy.view.ParticleManager.<init>(
  at raft.jumpy.view.GameView.<init>(

and this is the relavant particle class. taken from Robombs code I suppose:

Code: [Select]
   public Particle() {
      super(PLANE, true);

kind of urgent, OUYA will be launched for backers on 28 march ::)

Pages: [1] 2 3 ... 8