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 ... 4 5 [6] 7 8
76
Support / steps to take after Object3D.setMesh(mesh)
« on: January 06, 2010, 08:35:30 pm »
hi,

i created an Object3D with zero triangles and set a mesh to it. after this either calling build() or recreateTextureCoords() throws a null pointer exception at recreateTextureCoords().

what other steps should i take to prepare the object ?

77
Support / safely interpolate rotations
« on: January 04, 2010, 11:45:39 pm »
hi,

Ardor uses quaternions for rotations. in demo, it calculates a rotation from a vector to a vector and interpolates rotation with identity rotation. AFAIK with quaternions this is perfectly legal and make sense.

i tried to emulate this in jPCT by interpolating two matrices. sometimes results become very strange. i guess this happens when two rotations (matrices) are too different. afterall interpolating matrices for rotations does not makes sense mathematically.

so is there a safe way in jPCT to interpolate a rotation ?

r a f t

78
Support / translation
« on: January 03, 2010, 03:00:59 pm »
hi,

i've figured that, translation info in Object3D's rotation matrix effects where the object is rendered.

for example, this box is rendered at 1,0,0 point
Code: [Select]
Object3D box = Primitives.getBox(1, 1);
box.getRotationMatrix().set(3, 0, 1f);

is this intentional ?

79
Support / a rotation matrix from one direction to another
« on: January 02, 2010, 04:31:47 pm »
hi,

how can i create a rotation matrix such that, when applied, it rotates a direction vector to another ?

formally:
Code: [Select]
SimpleVector from;
Simplevector to;

from.matMul(m);
from.equals(to); // -> should be true ignoring rounding errors

80
Support / why 2 matrices ?
« on: January 01, 2010, 09:16:32 pm »
hi,

what's the purpose of having 2 matrices (rotation and translation) per Object3D ? AFAIK rotation matrix uses the upper left 3x3 part and translation matrix only uses the 3 entries in last row. seems as these can be merged into one, or not ?

why is it so ? for historical reasons or to maintain backwards compatibility or ?

thanks,
r a f t

81
Support / vertex sharing and vertex indices
« on: December 28, 2009, 07:13:16 pm »
hi,

indeed i would keep this as a surprise ::) what i'm after is to make a skeletal animation implementation based on Ardor3d's Collada loader. i'm aiming it will be very lightweight and the runtime will not require Ardor3d.

i've constructed the mesh out of Ardor3d's mesh, assigned texture and coordinates but stuck at vertex indices. Ardor3d stores weights and joint indices in buffers where data is ordered according to mesh vertices. i need a way to match ardor3d vertices and jPCT vertices but there seems no way. futhermore Ardor3d also makes its own vertex sharing among polygons (not sure if engine optimizes it or Collada file is already optimized but that doesnt matter). so Object3D.disableVertexSharing doesnt help either.

only solution i can think of is, use same exact vertices and vertex sharing in jPCT to create an Object3D.

so is it possible to add a method or constructor to Object3D which takes vertice and texture coordinates as float arrays and an int array as index buffer ?

thanks,
r a f t


82
Support / creating an object from FloatBuffer
« on: December 27, 2009, 06:58:28 pm »
hi,

i'm trying to reconstruct an Ardor3d object in jPCT. it internally stores mesh data (vertices and texture coords) as FloatBuffers. it then directly feeds GL with that float buffers:
Code: [Select]
GL11.glVertexPointer(3, 0, vertexBuffer);
and this is what i do in an Object3D constructor. read the data from vertex and textures buffers and create polygons out of them:

Code: [Select]
        FloatBufferData vertexCoords = mesh.getMeshData().getVertexCoords();
FloatBuffer vertexBuffer = mesh.getMeshData().getVertexBuffer();
vertexBuffer.rewind();

        FloatBufferData textureCoords = mesh.getMeshData().getTextureCoords().get(0);
FloatBuffer textureBuffer = textureCoords.getBuffer();
textureBuffer.rewind();

       
        final float[] vertexData = new float[3];
        final float[] textureData = new float[6];
       
for (int i = 0; i < vertexCoords.getTupleCount()/3; i++) {
System.out.println(i);

vertexBuffer.get(vertexData);
SimpleVector vert1 = new SimpleVector(vertexData);

vertexBuffer.get(vertexData);
SimpleVector vert2 = new SimpleVector(vertexData);
vertexBuffer.get(vertexData);

SimpleVector vert3 = new SimpleVector(vertexData);
textureBuffer.get(textureData);

addTriangle(vert1, textureData[0], textureData[1],
vert2, textureData[2], textureData[3],
vert3, textureData[4], textureData[5]);
}

something is definetly wrong as the constructed object is totally shapeless. any ideas ?

thanks,
r a f t

83
Support / applying a 3rd party transform
« on: December 26, 2009, 08:15:46 pm »
hi,

i want to apply ardor3d's transform to a jPCT object. it has a 3x3 rotation matrix, a translation and a scale vector. ardor3d's coordinate system differ from jPCT (Y up i guess)

i'm trying to create two jPCT matrices, fill them in and set as rotation and translation matrices on Object3D.

* translation: straightforward: new Matrix().translate(x, y, z)
* rotation: AFAIK in jPCT rotation matrix, only upper left 3x3 part is used. i guess filling them in will be enough. but how to handle coordinate system difference ?
* scale vector: jPCT does not directly support scaling at different axis. but is it possible to achive the effect by playing with matrices ?

ardor3d transform also has a method which returns a 4x4 matrix in the following form. maybe using it with some modification on the result makes more sense ?

Code: [Select]

 R R R Tx
 R R R Ty
 R R R Tz
 0 0 0 1
thanks,
r a f t


84
Support / create a pyramide pointing some location
« on: December 26, 2009, 06:51:21 pm »
hi,

i have two points: from and to. i want to create a pyramide so that, it's bottom center is placed at from and top corner is at to.

i'm using the following code but it doesnt correctly set direction. what's wrong here ?

Code: [Select]
public static Object3D createPyramide(SimpleVector from, SimpleVector to) {
SimpleVector direction = to.calcSub(from);
float length = direction.length();
Object3D p = Primitives.getPyramide(length);
// Pyramide is centered at origin, so move bottom to origin
p.translate(0, -length/2, 0);
p.setRotationMatrix(direction.getRotationMatrix());
p.translate(from);

return p;
}

thanks,
r a f t

85
Support / demos are broken under 64 bit linux
« on: December 07, 2009, 03:55:50 am »
adding 64 bit so's to jnlp desc may help

86
Support / feature request: continuous LoD
« on: November 13, 2009, 07:54:24 am »
hi all,

so jPCT has compiled objects, built in software mipmapping, multi-threading support and so on.. all so good :)

if i know Egon a bit, he is possibly already thinking of next big target, i suggest continuous LoD (level of detail) ;)

at the moment, as far as i know, there is practically no way to implement such a thing on top of jPCT. one can only add triangles to an object, move their vertices with an IVertexController but cannot remove.

using separate meshes for diffent LoD levels (as i did in karga) is an option, but it's not continous, does not look good because of the flop effect, is a real pain to configure and does not fit well for large scene objects.

just a suggestion..
vote for continous LoD ;)

r a f t

87
Support / textures are gone after some time
« on: October 20, 2009, 04:53:08 pm »
hi,

i've adapted new version of jPCT to karga. (not online yet) and been playing with mipmapping and multi threading. multi threading definetely increases fps one multi core machines :) mipmapping works almost identical to previous external MipMapper and i guess performs slightly better. and of course much easier to use. great job :)

however after some time, some of my textures are gone. it's like we have added an object with a missing texture. below are two shots:



i cannot regularly reproduce it, but i can say it happens with multi cores, mipmapping enabled and MOSTLY while resizing the window (creating a new FrameBuffer). i guess it's a multi-threading issue

any ideas ?

r a f t

88
Projects / SwingGL - Swing on top of OpenGL
« on: March 31, 2009, 11:26:08 pm »
hello,

for a few days i've been working on a crazy idea: making Swing work on top of OpenGL. which i think will be very useful if we make it run smoothly. so i've downloaded the jdk source and started digging into it

i first tried rendering, extended awt.Graphics2D and implemented some methods of it. luckily swing seems to use only a small portion of that methods and most can be easily implemented with OpenGL commands. there are some differences though. anyway, below screenshot will give an idea.. the main trick is making top level component believe that it's placed in a container and is visible. than it happily painted itself and its children on given GL based Graphics implementation

second i tried forwarding mouse events from LWJGL display to Swing. this one was hard. all major classes and methods in this process are package private. i still couldnt find a 'normal way' but made a nasty hack: set a private field of some class with reflection. this will almost certainly wont work on a non-Sun JVM and will possibly break in the future. but still proofs, with a proper interleave point making swing event system work offline is possible. i believe, with implementing a custom awt.Tookit and a dummy peer of some component, making event system work without reflection hack is possible. i just couldnt figure out how. maybe some Swing/AWT guru may help ?

later turn will come to keyboard events and keyboard focus. similarly i believe this would be possible with customizing toolkit..

i'm not sure i will have time and continue this project. the code is a mess now, i will publish it when i clean it up. maybe somene will continue it ? if anyone is interested, i will happily go into details..

here is a a web startable link. i tried it on Ubuntu Hardy and Win XP, it worked ok altough there are some small rendering differences. i especially wonder if it will work ok on MacOSX

below is a screenshot, SwingGL running on HelloWorld example (GL one)


cheers  ;D
r a f t

edit: SwingGL can be found at http://code.google.com/p/swing-gl/

89
Support / calling LWJGL methods directly
« on: March 30, 2009, 08:29:40 am »
hello,

what should i do to call opengl methods directly after jPCT has done ? for example the code below doesnt draw a line

Code: [Select]

while (loop) {
    // do jPCT things
    world.renderScene(buffer);
    world.draw(buffer);
    buffer.update();

    // do lwjgl things
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(10, 10);
    GL11.glVertex2f(50, 50);
    GL11.glEnd();

    buffer.displayGLOnly();
    Thread.sleep(10);
}

90
Support / blitting text and images
« on: March 18, 2008, 10:34:21 pm »
here is two small and (hopefully) handy classes for blitting text and images. i'm posting them hoping they may be helpful

TexturePack packs several arbitrary sized images into a jPCT texture. it automatically layouts images and adjusts Texture size.

GLFont creates GL renderable (blittable) fonts out of awt Fonts.

in the below image, the bubble images are blitted with TexturePack and text is blitted with GLFont :)


note: these two classes use new FrameBuffer.blit(..) method in the upcoming 1.16 release

cheers,
r a f t

Pages: 1 ... 4 5 [6] 7 8