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 - K24A3

Pages: [1] 2
1
Support / Lava shader
« on: May 02, 2013, 03:20:32 pm »
Anyone know where I can download a shader that mimics lava with the texture of an object?

Basically something that warps the texture dependent on a supplied variable between 0 and 255

2
Support / Calc 3rd SimpleVector in a line
« on: April 30, 2013, 12:14:21 pm »
Having a bit of a SimpleVector brain fade lol, trying to calculate the position of the yellow SimpleVector from the first two red SimpleVectors, but the yellow one has to be exactly 500 units away from the middle red SimpleVector.

I could dissect xyx of the vectors and do it the long way but what is the quickest and easiest way of doing this using calcSub etc..?

3
Support / OpenGL changes in Android 4.2
« on: December 04, 2012, 12:57:50 am »
This is a general OpenGL question not directly related to jPCT but I would like to ask if anyone here is aware of any OpenGL ES1.x changes in Android 4.2 (JellyBean MR1)?

@Egon, did you need to make any modifications for Jellybean compatibility?

I have an app that uses pure OpenGL ES1.1 and the textures are all messed up on multiple 4.2 devices plus the emulator. If I load 5 textures, the last texture loaded is used for all 5 textures, but if I load only 2 textures, those 2 textures render fine. The texture clipping is also not working properly. The whole texture is rendered instead of the clipping region.

I create the textures by:

int[] textures = new int[5];
gl.glGenTextures(5, textures, 0);

Then load an image resource into a byteBuffer and upload it to the GPU:

gl.glBindTexture(GL11.GL_TEXTURE_2D, textures[n])
gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR)     
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR)
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 512, 512,0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, byteBuffer) 

Drawing:

textureCrop0[0] = 0// Left
textureCrop0[1] = 0 // Bottom
textureCrop0[2] = 512// Width
textureCrop0[3] = 512 // Height
gl.glTexParameteriv(GL11.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, textureCrop0, 0)


Were any of these functions changed in 4.2?
            

4
Support / Confirming 32bit color output via jPCT
« on: October 05, 2012, 05:15:44 pm »
Is there a way to confirm that the app is rendering in 32bit mode via jPCT during runtime?

I've set everything up to use 8:8:8:8 but the output still looks 16bit with excessive color banding and I'm not sure if it's a texture/transparency issue or a configuration issue with the new Wallpaper service I'm using.


5
Support / setTransparency precision
« on: September 30, 2012, 04:19:54 pm »
Object3D.setTransparency(int trans) only seems to work from 0 to 15, anything over 15 defaults to the transparency of 15.

The difference between each level is quite a big jump. I need a smooth transition of a textured plane.

Is there a way to vary the transparency to 256 levels or a floating point value?
Can we add a new function that takes a float from 0.0 to 1.0? i.e. Object3D.setTransparency(float fTrans);

ps. The image already has alpha so I'm using the alpha flag when creating the texture (boolean useAlpha).

6
Support / getSphere high RAM usage
« on: September 27, 2012, 10:10:15 am »
I have about 32-50 textured spheres in my scene, they are fairly simple, no shaders (using default jPCT shaders), 256x256 texture sizes (total 5 textures shared).

For some reason when I increase the face count from 16 to 32, RAM usage almost doubles:

no spheres = 26MB/48MB
16 faces = 27MB/48MB
24 faces = 33MB/48MB
32 faces = 41MB/48MB

Surely adding an additional 16 faces per globe (800 extra in total) wouldn't cause such a huge spike?



obj3DMain = Primitives.getSphere(32, fScale); // 16 // 24
obj3DMain.setTexture(sTextureName);
obj3DMain.calcTextureWrapSpherical();
obj3DMain.strip();
obj3DMain.setSpecularLighting(true);
world.addObject(obj3DMain);   


jPCT 1.26 beta
OGL ES2.0
Galaxy Note / Intel Emulator+HAX (same outcome on both)

7
Support / Shaders and SetTransparency
« on: September 24, 2012, 04:12:57 pm »
I've just started learning ES2.0 using the included HelloShader example as a base, I'm trying to make the shaded face texture transparent using the usual Object3D.SetTransparency but it doesn't work at all. SetAdditionalColor also doesn't work.

Do these functions only work with standard non-shaded textures?

I'm guessing you would need to add these functions as code in the shader program.

8
Support / Billboard rotation
« on: January 30, 2012, 01:11:12 pm »
Is there a way to rotate a billboarded Object3D on it's Z Axis?

I have a textured plane that has billboarding enabled and would like to rotate it clockwise as if you were looking at a fan spinning from the front.

9
Support / Significant transparency difference on different GPU's
« on: January 19, 2012, 12:47:02 pm »
I'm using low transparency on my three multilayered skyboxes (3DS files not the jPCT skybox) and have found that there is a huge difference on two different GPU's, namely the Tegra2 and PowerVR (Omap 4430).

To equalize the transparency on both devices, I need to set the transparency much higher on the PowerVR.

Using Transparency of 4 looks vibrant on the Tegra2, but almost black on the PowerVR.
Using Transparency of 16 looks great on the PowerVR but too bright and very washed out on the Tegra2.

Setting the transparency to Additive doesn't resolve the problem.
I tried setting the transparency of the layers incrementally (for example 2, then 4, then 8 ) but that doesn't help.

I'm assuming it's a design trait of the GPU's in question, so the solution would be to detect the GPU and set the transparency accordingly or let the user modify the values manually.

Is this a generally known issue? Does jPCT calculate transparency based on OpenGL flags? Or am I missing something?

(OpenGL ES 1.1, jPCT 1.24)

10
Support / ClearRotation resets the scale
« on: December 22, 2011, 04:34:05 pm »
Is Object3D.clearRotation() supposed to reset the scaling of the object?

If yes, perhaps we can add a note to the docs mentioning that it will clear the scaling as well.
If not, it may be a bug because scaling gets reset when calling clearRotation() even after I build the object3D before cloning it. I believe the original object3D is also affected so build->clone is irrelevant.

This was driving me nuts for an hour until I traced it to clearRotation()  :P

11
Support / Interpolate smoothly between animation sequences
« on: November 30, 2011, 11:43:31 am »

When changing the sequence from say object3D.animate(fAnim, 1) to object3D.animate(fAnim, 2) causes the animation to snap instantly.

Is there an option to interpolate smoothly between sequences? Or must this be done manually by controlling the float index so the index is reset to zero before switching sequences? (assuming that each sequence uses the same mesh when at index 0f)

12
Support / Huge RAM usage when rendering
« on: November 27, 2011, 04:07:06 am »
I'm seeing a huge difference between the RAM usage on a phone and a tablet. My project only uses 16MB/32MB on the phone, but 45MB/48MB on the Tablet. The Tablet intermittently throws an out of memory exception when rendering. (I'm using jPCT 1.24)


To rule out a bug in my project, I created a test app with 50 spheres using no texture. I clone 49 spheres from the first sphere.

In the test app, the Tablet is using 20MB compared to 9MB on the phone.


PowerVR Omap4430 Gingerbread 2.3.5 phone:
- 6MB/32MB after loading textures
- 8MB/32MB after calling world.buildallobjects()
- 9MB/32MB when rendering

Tegra2 Honeycomb 3.1 Tablet:
- 8MB/48MB after loading textures
- 9MB/48MB after calling world.buildallobjects()
- 20MB/48MB when rendering

I tried MemoryHelper.compact(), mesh.compress(), but it made little difference.
I tried using Primitives.getSphere() on all 50 objects instead of using clone(), but that only increased the usage by one or two MB.

I doubt it's a screen resolution problem because they are not much different.
Phone: 960×540
Tablet: 1280x800

I doubt there is a memory leak, the RAM usage is generally consistent after 20 minutes.

I can't figure out why so much RAM is used. Perhaps the Tegra2 OpenGL driver is inefficient? Or is jPCT loading extra poly/vertex information on the Tablet?


Attached are the logs and main class.


[attachment deleted by admin]

13
Support / Rotate an object to match another object's rotation matrix
« on: October 20, 2011, 09:43:32 am »
I have two Matrices;

1) object3D1: The source Object3D rotational matrix (getRotationMatrix())
2) object3D2: The destination Object3D rotational matrix (getRotationMatrix())

I would like to slowly rotate the source object to match the rotation matrix of the destination object frame by frame, so both rotations are exactly the same (both objects are facing the same way).

I'm guessing I can use object3D1.getZAxis() and object3D2.rotateAxis() but how do you do the calculations?

Or can I use Matrix.interpolate()?


14
Support / Aligning bullets/projectiles from player location
« on: October 14, 2011, 06:52:42 pm »
Is there an 'official' way of aligning/rotating projectiles shot from a 3D Object?

I've managed to whip up the following code:

Code: [Select]
SimpleVector sv = new SimpleVector();
sv = player.getZAxis();
bullet[n].clearTranslation();
bullet[n].clearRotation();
bullet[n].setRotationPivot(sv);
bullet[n].align(player);
sv = player.getTranslation();
sv.y += 6f; // Adjust offset
sv.x -= 2f; // Adjust offset
bullet[n].translate(sv);

Which works ok but the bullet is shot with a slight translation offset depending on the axis of the player.
I realize that sv.y+=6f and sv.x-=2f; is probably the cause, but I was wandering if there is a concrete solution for projecting projectiles from a 3D object.

15
Support / Calculate rotation angle from movement (translation)
« on: October 09, 2011, 10:58:07 am »
I'm trying to rotate an object so it's facing the way it's moving.

Is there a function in jPCT or Java that can calculate the rotation angle based on an object's translation movement?


If the object is travelling up Z using translation(0,0,2), the angle would be 270 degrees.
If the object is travelling down Z  using translation(0,0,-2), the angle would be 90 degrees (or PI/2).
If the object is travelling up X  using translation(2,0,0), the angle would be 0 degrees.
If the object is travelling down X  using translation(-2,0,0), the angle would be 180 degrees (or PI).
If the object is travelling down X and up Z using translation(-2,0,2), the angle would be 225 (270-180).

Pages: [1] 2