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

Pages: 1 ... 7 8 [9] 10 11 ... 822
121
Support / Re: Cpct?
« on: April 23, 2021, 07:25:39 am »
I'm not sure what you mean, because there is ARBMultitexture-stuff in your code anyway. However, it might be worth a try and see if your constants are the same as they are in normal OpenGL. These should just be integers and if your toolkit isn't doing something really strange with them, something like PrimitiveType.Triangles should have the same value as OpenGL's GL_TRIANGLES.

122
That's not very likely. It's either a device/driver issue or some flaw in the implementation itself. Please try adjusting Config.specPow and report back with the results.

123
Is that on your device or in the emulator? The sphere looks fine to me, but the car somehow doesn't. There's a setting in Config called specPow. Have to tried to adjust that (higher or lower than the default of 6) to see if that changes the results under ES 2.0?

124
There's no need to set any parameters in the default shaders. Their purpose is to mimic GL 1.x behaviour automatically. I'm unsure why this doesn't happen here though.

Here's a test case that I've hacked together that show specular lighting on a sphere in ES 2.0. Maybe you can run that on your device with and without specular lighting enabled and report the results.

Code: [Select]
package com.threed.jpct.example;

import java.lang.reflect.Field;

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

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.util.Log;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Light;
import com.threed.jpct.Logger;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;

public class HelloWorld extends Activity {

private static HelloWorld master = null;

private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer fb = null;
private World world = null;

private int fps = 0;

private Light sun = null;

private GL10 lastGl = null;

private RGBColor back = new RGBColor(50, 50, 10);
public Object3D obj;
public Texture texture;

protected void onCreate(Bundle savedInstanceState) {

Logger.log("onCreate");

if (master != null) {
copy(master);
}

super.onCreate(savedInstanceState);

mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLContextClientVersion(2);
mGLView.setPreserveEGLContextOnPause(true);

renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);
}

@Override
protected void onPause() {
super.onPause();
mGLView.onPause();
}

@Override
protected void onResume() {
super.onResume();
mGLView.onResume();
}

@Override
protected void onStop() {
super.onStop();
System.exit(0);
}

private void copy(Object src) {
try {
Logger.log("Copying data from master Activity!");
Field[] fs = src.getClass().getDeclaredFields();
for (Field f : fs) {
f.setAccessible(true);
f.set(this, f.get(src));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

protected boolean isFullscreenOpaque() {
return true;
}

class MyRenderer implements GLSurfaceView.Renderer {

private long time = System.currentTimeMillis();

public MyRenderer() {
}

public void onSurfaceChanged(GL10 gl, int w, int h) {

// Renew the frame buffer
if (lastGl != gl) {
Log.i("HelloWorld", "Init buffer");
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(w, h);
fb.setVirtualDimensions(fb.getWidth(), fb.getHeight());
lastGl = gl;
} else {
fb.resize(w, h);
fb.setVirtualDimensions(w, h);
}

if (master == null) {
world = new World();
world.setAmbientLight(70, 70, 70);

sun = new Light(world);
sun.setIntensity(200, 200, 200);

obj = Primitives.getSphere(50,15);
world.addObject(obj);
obj.translate(0, 0, 0);
obj.build();

// Specular lighting
obj.setSpecularLighting(true);

Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 35);
cam.lookAt(SimpleVector.ORIGIN);

SimpleVector sv = new SimpleVector();
sv.set(SimpleVector.ORIGIN);
sv.y -= 70;
sv.z -= 70;
sun.setPosition(sv);
MemoryHelper.compact();

if (master == null) {
Logger.log("Saving master Activity!");
master = HelloWorld.this;
}
}
}

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

public void onDrawFrame(GL10 gl) {
SimpleVector sv=sun.getPosition();
sv.rotateY(0.02f);
sun.setPosition(sv);

fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();

if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + "fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;
}
}

public static HelloWorld getApp() {
return master;
}
}


Edit: I assume that you are using the latest version of jPCT-AE?

125
Support / Re: Cpct?
« on: April 20, 2021, 09:09:54 am »
Opps, no....that's supposed to be col.getGreen(). The Android version does is correctly though.

127
Support / Re: Cpct?
« on: April 20, 2021, 07:29:02 am »
Yes. OpenGL is a state machine. Maybe the state is correct for this one bush and gets screwed up afterwards.

128
It might also help to know what exactly this "mobile phone" is!? Model number, Android version?

129
Support / Re: Cpct?
« on: April 19, 2021, 02:56:56 pm »
Most likely that something is wrong with your vertex array setup and/or rendering code. Wireframe rendering are just simple call to glVertex3f, which draw one line at a time. Everything else is more complex, so there is an increased chance of getting it wrong at some stage.

130
Support / Re: Cpct?
« on: April 19, 2021, 07:41:28 am »
I'm not sure what this number represents, but if it's the size, it might not be unreasonable, if you have many smaller models and/or smaller parts of the model that are using different textures.

131
I'm not sure what you mean. Which image is which? Is that in ES 2.0 or 1.x mode?

132
You can forget about the simulator in OpenGL ES 2.0 mode. At least that was my experience, so I stopped using it altogether. There are some alternative Android emulators available, maybe one of them works better.

133
Some devices don't really support it even if they should. Which version of OpenGL is your app using? if it's OpenGL ES 1.x, try OpenGL ES 2.0 instead. See: https://www.jpct.net/wiki/index.php?title=OpenGL_ES_2.0_support

134
Support / Re: Cpct?
« on: April 12, 2021, 03:41:15 pm »
Good to hear that!

135
Support / Re: Gradle support
« on: April 08, 2021, 12:06:28 pm »
I've no plans on adding anything like that, I'm afraid.

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