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

Pages: 1 [2]
16
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

17
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

18
Support / Object3D's transparency issue
« on: December 06, 2014, 12:07:56 pm »
Hey everyone,

I had a hard time trying to register to this forums, so I used my schoolemail...  :o
Anyway, I have an issue with 2 Object3D's...
Both objects are cubed. They have individual textures on each face.
Both objects have this transparency value:
Code: [Select]
this.setTransparency(300);
Box1 is in box2. (their center point is equal)
Box1's dimensions: 2f * 2f * 2f
Box2's dimensions: 2.2f * 2.2f * 2.2f
Box2 has more transparent area's than box1.
However, box2's non-transparent textures don't seem to be visible...
When I remove
Code: [Select]
this.setTransparency(300); from box1, then those non-transparent textures do show up... (but then I get black-ish areas on the box1 texture...)

How can I solve this problem?

Cheers,
Abiram

PS: This library is AWESOME   ;D

Pages: 1 [2]