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 ... 18 19 [20] 21 22
286
Support / Re: EGL_BAD_ALLOC error
« on: April 07, 2015, 07:01:46 pm »
So basically:
Code: [Select]
throw new RuntimeException(
"Could not get the String from the Resources", e1);

287
Support / Re: EGL_BAD_ALLOC error
« on: April 05, 2015, 02:17:01 pm »
Something like this?:
Code: [Select]
private String getStringFromFile(final int id) {
final InputStream stream1 = getResources().openRawResource(id);
final BufferedReader reader = new BufferedReader(
new InputStreamReader(stream1));
String result = "";
try {
String line;
while ((line = reader.readLine()) != null) {
result += line + "\n";
}
} catch (final IOException e1) {
final InputStream stream2 = getResources().openRawResource(id);
result = Loader
.loadTextFile(stream2);
try {
stream2.close();
} catch (IOException e2) {
// Doesn't matter
e2.printStackTrace();
}
if (result == "" || result == null) {
throw new RuntimeException(
"Could not get the String from the Resources");
} else {
return result;
}
} finally {
try {
stream1.close();
reader.close();
} catch (IOException e3) {
// Doesn't matter
e3.printStackTrace();
}
}
return result;
}

One problem is that this error does not show up a lot in the Google Play Store Developers Console really... Which makes it harder for me to judge whether the bug/crash is fixed or not.

288
Support / Re: EGL_BAD_ALLOC error
« on: March 27, 2015, 11:43:44 am »
GLSLShader loader:
Code: [Select]
GLSLShader shader = new GLSLShader(getStringFromFile(R.raw.alphatest_vs),
getStringFromFile(R.raw.alphatest_fs));

//apply to all objects
iH = new InnerHead(shader);
oH = new OuterHead(shader);

Textfile loader:
Code: [Select]
private String getStringFromFile(int id) {
final InputStream stream = getResources().openRawResource(id);
final BufferedReader reader = new BufferedReader(new InputStreamReader(
stream));
String result = "";
try {
String line;
while ((line=reader.readLine()) != null) {
result += line + "\n";
}
} catch (final IOException e) {
e.printStackTrace();
}
return result;
}

289
Support / Re: EGL_BAD_ALLOC error
« on: March 25, 2015, 02:15:08 pm »
Yes this is the complete log output

290
Support / Re: EGL_BAD_ALLOC error
« on: March 23, 2015, 05:10:43 pm »
Hmm okay...

Another problem (offtopic again, sorry):

I sometimes get this crashreport, but I don't know why most people don't get it...:
Code: [Select]
java.lang.RuntimeException: [ 1427084178793 ] - ERROR: Failed to load and compile fragment shaders!
at com.threed.jpct.Logger.log(Logger.java:206)
at com.threed.jpct.GLSLShader.loadProgram(GLSLShader.java:1077)
at com.threed.jpct.GLSLShader.preInit(GLSLShader.java:285)
at com.threed.jpct.GL20.setShader(GL20.java:362)
at com.threed.jpct.GLRenderer.setShader(GLRenderer.java:553)
at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:189)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2308)
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:1522)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1368)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

This error occured for my users on:
Android 4.4: 5x
Android 4.3: 1x
Android 2.3.x: 9x

Fragment shader:
Code: [Select]
precision highp float;

uniform sampler2D textureUnit0;

varying vec2 texCoord;
varying vec4 vertexColor;

void main() {
gl_FragColor= texture2D(textureUnit0, texCoord) * vertexColor;
        if (gl_FragColor.a<0.5) {
           discard;
        }
}

Any help would be welcome! ^.^

Cheers,
Abiram

291
Support / Re: EGL_BAD_ALLOC error
« on: February 14, 2015, 12:29:35 pm »
A bit offtopic but is it possible to bend an Object3D.
For instance, let's say I have an cube object (uv mapped). Is it possible to curve/bend it so there probably will be more vertices, but it still has the appropriate texture on each cube face. Bend/curve = making a cube a bit 'U' shaped for example.

Sorry for this question, I am very noob at OpenGL related stuff :/

292
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);

293
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);]

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

295
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.

296
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?

297
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)...

298
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...

299
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

300
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

Pages: 1 ... 18 19 [20] 21 22