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.


Messages - AeroShark333

Pages: 1 ... 7 8 [9] 10
121
Support / Re: EGL_BAD_ALLOC error
« on: February 08, 2015, 12:55:57 am »
So passing "Runnable"s to the GLSurfaceView thread should solve my problem, right?

Edit: Using GLSurfaceView.queueEvent(Runnable r);

122
Support / Re: EGL_BAD_ALLOC error
« on: February 07, 2015, 09:34:34 pm »
java.lang.NullPointerException
at com.threed.jpct.GLRenderer.setTextures(GLRenderer.java:2441)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2297)
at com.threed.jpct.World.draw(World.java:1417)
at com.threed.jpct.World.draw(World.java:1100)
at com.aeroshark333.skinviewer.SkinActivity$ViewerRenderer.onDrawFrame(SkinActivity.java:1048)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1146)

How does this happen?

line 1048: [mainWorld.draw(frameBuffer);]

123
Projects / Re: Thinking about some RPG..Android version.
« on: January 29, 2015, 10:37:53 pm »
Those leaves sure do look realistic!
Nice work

124
Support / Re: EGL_BAD_ALLOC error
« on: January 22, 2015, 02:53:31 pm »
Hmm, I can add android:largeHeap="true"
However, I do not think that would fix the error on Android 2.2 devices.
Why? Because the largeHeap feature is added in API Level 11.
Android 2.2 (API Level 8 ) would ignore that line, since it's function is known.

125
Support / Re: EGL_BAD_ALLOC error
« on: January 22, 2015, 11:53:07 am »
I really do noy have a clue...
The Play Store doesn't give more information tham that.
Any other suggestions?

126
Support / Re: EGL_BAD_ALLOC error
« on: January 22, 2015, 07:48:45 am »
Update.

New error:
Code: [Select]
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1229)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1187)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1514)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1267)
But this time it is not on Android 2.2, but Android 4.0.3 - 4.0.4.
Device: nuclear-XIONhh901

I couldn't find anything about this device.
However, the Android 2.2 devices all had an Andreno 200 GPU (if that matters)...

127
Support / Re: EGL_BAD_ALLOC error
« on: January 21, 2015, 11:17:30 pm »
I mainly found that adding (instance GLSurfaceView).onPause() and (instance GLSurfaceView).onResume() should work in the Overridden methods of Activity. However, I already have those...

128
Support / EGL_BAD_ALLOC error
« on: January 21, 2015, 05:38:51 pm »
Hello everyone,

I hope I can get some help with an odd error.
I am getting this error a lot lately in the Google Developers Console:
Code: [Select]
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1077)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1035)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1333)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

I got three reports of this error.
I found it odd that all three reports came from Android 2.2 devices.
Devices:
Galaxy Mini (GT-S5570)
IDEOS S7 Slim (qsd8k_slim)
Galaxy Precedent (SCH-M828C)

I hope that I can get some help with this error! :)

Cheers,
Abiram

129
Projects / Skin Viewer 3D
« on: January 19, 2015, 11:01:58 am »
Hey guys,

I made an app called: Skin Viewer 3D.
It uses jPCT-AE for the 3D viewer and the live wallpaper! :)

This is how it looks like:


I don't think most of you people here would be interested in a Minecraft app but make sure to check it out if you are! :)

Some code I wanted to share (how I added rain and snow to the app):
(I don't know if this is neat code or not, but I hope it might be useful to some people. I am a beginning Java programmer ;p)

SkinActivity.java (incomplete!)
Code: [Select]
package com.aeroshark333.skinviewer;

import com.aeroshark333.skinviewer.weather.Rain;
import com.aeroshark333.skinviewer.weather.Snow;
import com.aeroshark333.skinviewer.weather.WeatherManager;

import com.threed.jpct.FrameBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLSurfaceView;

public class SkinActivity extends Activity {

class ViewerRenderer implements GLSurfaceView.Renderer {
private FrameBuffer frameBuffer;
private final WeatherManager wM;

public ViewerRenderer() {
this.wM = new WeatherManager();
}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (frameBuffer != null) {
// don't reset.
return;
}
if (Build.VERSION.SDK_INT < 8) {
this.frameBuffer = new FrameBuffer(gl, width, height);
} else {
this.frameBuffer = new FrameBuffer(width, height);
}

//to add snow:
this.wM.setGroup(new Snow(this.frameBuffer
.getWidth(), this.frameBuffer.getHeight()));

//to add rain:
this.wM.setGroup(new Rain(this.frameBuffer
.getWidth(), this.frameBuffer.getHeight()));

//to reset:
this.wM.resetGroup();
}

@Override
public void onDrawFrame(GL10 gl) {
frameBuffer.clear();
wM.update(frameBuffer);
frameBuffer.display();
}

}
}

WeatherManager.java (complete)
Code: [Select]
package com.aeroshark333.skinviewer.weather;

import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Texture;

public class WeatherManager {
private Weather group;

public WeatherManager() {

}

public void update(final FrameBuffer frameBuffer) {
if (group == null) {
return;
}

final Texture t1 = group.getTexture();
final int sWidth = frameBuffer.getWidth();
final int sHeight = frameBuffer.getHeight();

if (group instanceof Snow) {
// snow
for (int[] particle : group.getParticles()) {
frameBuffer.blit(t1, 50, 50, particle[0], particle[1], 50, 50,
particle[2], particle[2], -1, false);
particle[1] = particle[1] + 1;
final double random = Math.random();
if (random < 0.25d) {
particle[0] = particle[0] + 1;
}
if (random > 0.75d) {
particle[0] = particle[0] - 1;
}
if (particle[0] > sWidth) {
particle[0] = sWidth / 2;
}
if (particle[0] < 0) {
particle[0] = sWidth / 2;
}
if (particle[1] > sHeight) {
particle[1] = 0;
}
}
} else {
// rain
for (int[] particle : group.getParticles()) {
frameBuffer.blit(t1, 50, 50, particle[0], particle[1], 50, 50,
(particle[2] / 3) + 1, particle[2] * 3, -1, false);
particle[1] = particle[1] + 6;
final double random = Math.random();
particle[0] = particle[0] - 1;
if (random < 0.50d) {
particle[0] = particle[0] - 1;
}
if (random < 0.125d) {
particle[0] = particle[0] - 1;
}
if (particle[0] < 0) {
particle[0] = sWidth - 2;
}
if (particle[1] > sHeight) {
particle[1] = 0;
}
}
}
}

public void setGroup(Weather weathergroup) {
this.group = weathergroup;
}

public boolean hasGroup() {
if (this.group != null) {
return true;
}
return false;

}

public void resetGroup() {
this.group = null;
}
}

Weather.java (complete)
Code: [Select]
package com.aeroshark333.skinviewer.weather;

import java.util.ArrayList;

import com.threed.jpct.Texture;

public interface Weather {
public ArrayList<int[]> getParticles();
public void addParticles(final int amount);
public Texture getTexture();
}

Snow.java (complete)
Code: [Select]
package com.aeroshark333.skinviewer.weather;

import java.util.ArrayList;

import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;

public class Snow implements Weather {
// int[]{posX,posY,size}
final private ArrayList<int[]> snowParts;
final int width, height;
final Texture texture;

public Snow(int w, int h) {
snowParts = new ArrayList<int[]>();
this.height = h;
this.width = w;
this.texture = TextureManager.getInstance().getTexture("snow");

addParticles((h * w / 9999) * 6);

}

@Override
public void addParticles(final int amount) {

for (int x = 0; amount > x; x++) {
final int posX = width - ((int)(Math.random() * (double)width));
final int posY = height - ((int)(Math.random() * (double)height));
final int size = (int) ((Math.random()*(double)height * (double) width / 225000d)+ 2.25d);
snowParts.add(new int[] { posX, posY, size });
}
}
@Override
public ArrayList<int[]> getParticles() {
return snowParts;
}

@Override
public Texture getTexture() {
return this.texture;
}

}

Rain.java (complete)
Code: [Select]
package com.aeroshark333.skinviewer.weather;

import java.util.ArrayList;

import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;

public class Rain implements Weather {
// int[]{posX,posY,size}
final private ArrayList<int[]> rainParts;
final int width, height;
final Texture texture;

public Rain(int w, int h) {
rainParts = new ArrayList<int[]>();
this.height = h;
this.width = w;
this.texture = TextureManager.getInstance().getTexture("rain");

addParticles((h * w / 9999) * 9);

}

@Override
public void addParticles(final int amount) {

for (int x = 0; amount > x; x++) {
final int posX = width - ((int) (Math.random() * (double) width));
final int posY = height - ((int) (Math.random() * (double) height));
final int size = (int) ((Math.random() * (double) height
* (double) width / 225000d) + 2.25d);
rainParts.add(new int[] { posX, posY, size });
}
}

@Override
public ArrayList<int[]> getParticles() {
return rainParts;
}

@Override
public Texture getTexture() {
return this.texture;
}

}

Feel free to use this code.
This is not 3D snow though!

Cheers,
Abiram

130
Support / Re: Object3D's transparency issue
« on: January 10, 2015, 02:09:31 pm »
You sir, are an hero!
The shader worked for him (as well for me)
Thanks so much :D

Yeah... I should have kept using either box# or this# and not both... It does not really look neat at the moment.

And correct, I am only using ambient lighting, no fog and one texturelayer per object.

Thanks for your time, input and fast responses :)
I hope not to have wasted your time... If so, I am sorry.

131
Support / Re: Object3D's transparency issue
« on: January 09, 2015, 10:00:30 pm »
...either that, or your updated versions won't get executed on the actual device. Can you somehow confirm that your changes really make it onto the device? If you remove the discard, the resulting shader is the normal default shader that jPCT-AE uses and i'm not aware of any problems with that. Also, please make sure that you are calling build() on all of your Object3Ds.

However, there are other, simpler default shaders. We could try to modify one of them. But for choosing one, i have to know which features you are actually using. So...

  • Are you using light sources or just ambient lighting?
  • If you are using lights, how many?
  • Are you using fog?

Code: [Select]
package com.aeroshark333.skinviewer.skinparts;

import com.threed.jpct.GLSLShader;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.TextureManager;

public class Body extends Object3D {

private static final long serialVersionUID = 8216608860877707087L;

public Body(final GLSLShader shader) {

super(12);

final Object3D box = this;

SimpleVector upperLeftFront = new SimpleVector(-1, -1.5f, -0.5f);
SimpleVector upperRightFront = new SimpleVector(1, -1.5f, -0.5f);
SimpleVector lowerLeftFront = new SimpleVector(-1, 1.5f, -0.5f);
SimpleVector lowerRightFront = new SimpleVector(1, 1.5f, -0.5f);

SimpleVector upperLeftBack = new SimpleVector(-1, -1.5f, 0.5f);
SimpleVector upperRightBack = new SimpleVector(1, -1.5f, 0.5f);
SimpleVector lowerLeftBack = new SimpleVector(-1, 1.5f, 0.5f);
SimpleVector lowerRightBack = new SimpleVector(1, 1.5f, 0.5f);

// Front
box.addTriangle(upperLeftFront, 0, 0, lowerLeftFront, 0, 1,
upperRightFront, 1, 0, TextureManager.getInstance()
.getTextureID("bodyfront"));
box.addTriangle(upperRightFront, 1, 0, lowerLeftFront, 0, 1,
lowerRightFront, 1, 1, TextureManager.getInstance()
.getTextureID("bodyfront"));
// Back
box.addTriangle(upperLeftBack, 0, 0, upperRightBack, 1, 0,
lowerLeftBack, 0, 1,
TextureManager.getInstance().getTextureID("bodyback"));
box.addTriangle(upperRightBack, 1, 0, lowerRightBack, 1, 1,
lowerLeftBack, 0, 1,
TextureManager.getInstance().getTextureID("bodyback"));
// Top
box.addTriangle(upperLeftBack, 0, 0, upperLeftFront, 0, 1,
upperRightBack, 1, 0, TextureManager.getInstance()
.getTextureID("bodytop"));
box.addTriangle(upperRightBack, 1, 0, upperLeftFront, 0, 1,
upperRightFront, 1, 1, TextureManager.getInstance()
.getTextureID("bodytop"));
// Bottom
box.addTriangle(lowerLeftBack, 0, 0, lowerRightBack, 1, 0,
lowerLeftFront, 0, 1, TextureManager.getInstance()
.getTextureID("bodybottom"));
box.addTriangle(lowerRightBack, 1, 0, lowerRightFront, 1, 1,
lowerLeftFront, 0, 1, TextureManager.getInstance()
.getTextureID("bodybottom"));
// Right
box.addTriangle(upperLeftFront, 0, 0, upperLeftBack, 1, 0,
lowerLeftFront, 0, 1, TextureManager.getInstance()
.getTextureID("bodyright"));
box.addTriangle(upperLeftBack, 1, 0, lowerLeftBack, 1, 1,
lowerLeftFront, 0, 1, TextureManager.getInstance()
.getTextureID("bodyright"));
// Left
box.addTriangle(upperRightFront, 0, 0, lowerRightFront, 0, 1,
upperRightBack, 1, 0, TextureManager.getInstance()
.getTextureID("bodyleft"));
box.addTriangle(upperRightBack, 1, 0, lowerRightFront, 0, 1,
lowerRightBack, 1, 1, TextureManager.getInstance()
.getTextureID("bodyleft"));

box.setName("body");
this.setTransparency(-1);
this.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
this.setShader(shader);
this.compile();
this.strip();
box.build();
}
}
This code is okay right?

  • Are you using light sources or just ambient lighting?
  • Just ambient lighting
  • If you are using lights, how many?
  • One, the ambient lighting
  • Are you using fog?
  • No.

Code: [Select]
this.mainWorld.setAmbientLight(255, 255, 255);

Well... I gave him an .apk file with the custom shader not set to the right leg.
That DID show him the right leg properly.

132
Support / Re: Object3D's transparency issue
« on: January 09, 2015, 12:05:22 pm »
Okay I tried a few things.
1. discard before gl_FragColor
2. discard after gl_FragColor
3. Option 1 + highp
4. Option 2 + highp
5. The shader code by Lobby without discard

Apparently none worked, so the problem is not the discard (I think)

133
Support / Re: Object3D's transparency issue
« on: January 08, 2015, 11:30:48 am »
No luck with the textures square as well :(
Are there any other options?
Perhaps similar/alternative code that does the same as
Code: [Select]
discard;? (I don't think 'return;' would solve it.

134
Support / Re: Object3D's transparency issue
« on: January 07, 2015, 03:05:51 am »
Thanks for adding it to the projectlist!

Some bad news from the user, the new fragment shader does not work... :(

135
Support / Re: Object3D's transparency issue
« on: January 06, 2015, 06:23:17 pm »
It was using OpenGL 2 yes
I am 100% sure I am using OpenGL2 since the beginning.

Sorry for the misinterpretation by the way

Pages: 1 ... 7 8 [9] 10