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

Pages: [1]
1
Support / Re: Understanding Problems with translate
« on: November 12, 2012, 11:05:23 am »
 :-X

Right! Damn...  :-[ Thank you!

2
Support / Understanding Problems with translate
« on: November 12, 2012, 09:41:38 am »
Good Morning jpct-Masters,

I'am having some problems to undesrstand how translate works.

I have two simple planes which shall move to the direction of each other plane (see the picture). For that I use an own class to translate both planes to move one plane to the top and one plane to the bottom. Both planes shall stop in the middle of the screen.

To manipulate the speed of planes moving to each other I played around with my var roundtripStep (0.01f, 0.001f, 0.1f). Everytime I change that var the planes stop moving in a different position. If setting roundtripStep to 0.01f and stop moving if var rounttrip reaches 1.4f works for me and both planes stop moving where they should (see picture). But if ein change roundtripStep to 0.001f the planes stop moving in a totally different place.

I would expect that both planes are still stopping where they should but move a little bit slower when I change roundtripStep to 0.001f.

Am I overlook something?

Thanks and kind regards

Code: [Select]
class WorldModifierAssembleGameBoard {

    boolean BoardAssembled = false;
    boolean run = true;
    float roundtrip = 1;
    float roundtripStep = 0.01f;
    boolean runModifier(World world, int secCounter, TextureManager tm, int DisplayHeight, int DisplayWidth) {
        Logger.log("Run: AssembleGameBoard");
        if(this.run) {
           
            world.getObjectByName("top1").translate(0, roundtrip, 0);
            world.getObjectByName("bottom1").translate(0, -roundtrip, 0);
            this.roundtrip = this.roundtrip+roundtripStep;
            Logger.log("Roundtrip = " + this.roundtrip);
           
            if (this.roundtrip >= 1.4f) {
                this.run = false;
            }
           
        }   
        return this.run;
    }   
    void setRun(boolean run) {
        this.run = run;
    }
   
}

[attachment deleted by admin]

3
Support / Re: Aksing the framebuffer width and hight gives strange Values
« on: December 20, 2011, 11:28:29 pm »
Thank you for your help,

I think that did the job. At my Manifest I removed android:resizeable="true" . After that the resolution is correct.

Many thanks!!!

4
Support / Aksing the framebuffer width and hight gives strange Values
« on: December 19, 2011, 10:38:47 pm »
Hello,

searching the forum gives me no hint about my problem. Maybe you know somethin about that.

I initialize my frame buffer due to some samples. At the moment I am working on some tests about overlays. The overlays should fit its size relative to the frame buffer width and hight.

Am I right if I assume that the framebuffer.getHeight() and framebuffer.getWidth() should be the same as my screensize on my device?

Everytime I ask the framebuffer  for its dimensions I get something like (nearly the same on my sgs2 and the emulator)

12-19 22:27:04.780: INFO/System.out(14500): AUFLÖSUNG HEIGHT!: 320
12-19 22:27:04.780: INFO/System.out(14500): AUFLÖSUNG WIDTH!: 533

The Initialisation of my mglview:
Code: [Select]
mGLView = new GLSurfaceView(getApplication());

mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];

}

My Renderer:
Code: [Select]
    //----------------DER RENDERER----- EMBD KLASSE----------
    class GameRenderer implements GLSurfaceView.Renderer {

    // Faramecounter
    private int fps = 0;
    //private int lfps = 0;
    private long fpsTime = System.currentTimeMillis();
   
    private boolean stop = false;
   
    //Voreinstellungen für den Renderer
    public GameRenderer() {
Config.maxPolysVisible = 500;
Config.farPlane = 3000;
Config.glTransparencyMul = 0.1f;
Config.glTransparencyOffset = 0.1f;
Config.useVBO=true;

Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}
    public void stop() {
stop = true;
}
   
@Override
public void onDrawFrame(GL10 arg0) {

try {
if (!stop) {

//Block für das Gesamtrendering
fb.clear(fbBackgroundColor);


if (GameWorldVisible) {
GameWorld.renderScene(fb);
GameWorld.draw(fb);
}
if (EnvBoxWorldVisible) {
EnvBoxWorld.renderScene(fb);
EnvBoxWorld.draw(fb);
}
if (OverlayWorldVisible) {
OverlayWorld.renderScene(fb);
OverlayWorld.draw(fb);
}
if (SystemMessageWorldVisible) {
SystemMessageWorld.renderScene(fb);
SystemMessageWorld.draw(fb);
}
checkConnection();

//WorldModifier.checkAndExecute();


fb.display();
//Ende Block für das Gesamtrendering
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Drawing thread terminated!", Logger.MESSAGE);
}

}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (fb != null) {
fb.dispose();
}
// Analyse der Displaygröße und übergabe an den Framebuffer
fb = new FrameBuffer (gl, width, height);
//fb = new FrameBuffer (gl, 800, 400);
}
...
...
...
...

I think setting the framebuffer size by hand is not the soultion....

Do you have any ideas?

Kind regards

5
Support / Re: Problems with texture allignment on 3ds files
« on: March 03, 2011, 04:08:51 pm »
Ok, I am sorry for that.
It was, as what you told. So a blender handling problem.  ::) I hat to add an material with texture to the blender model.

Thanks!  ;D

6
Support / Re: Problems with texture allignment on 3ds files
« on: March 03, 2011, 03:55:47 pm »
Thanks for editing.
Ok it looks like I have a blender problem. Maybe I should crawl some blender tuts.
Println says:
.....
1191/1: (0.0,1.0,0.0)
1191/2: (0.0,1.0,0.0)
1192/0: (0.0,1.0,0.0)
1192/1: (0.0,1.0,0.0)
1192/2: (0.0,1.0,0.0)
1193/0: (0.0,1.0,0.0)
1193/1: (0.0,1.0,0.0)
1193/2: (0.0,1.0,0.0)

For every line. Seems that there are no uv mappings... :-/

7
Support / Problems with texture allignment on 3ds files
« on: March 03, 2011, 09:26:45 am »
Hello togehter,
after some days searching in this forum it´s time to post my first question.

I have following problem: I try do write a serializer for 3ds files. I am a bleeding beginner in things like jpct so please be patient. So the first thing I played with the examples. After playing a little bit around I designed my own 3ds files and textures. The current step I stuck is to correctly apply textures to my 3ds file. Somehow I can´t get it working to apply my textures like in blender.

I designed a 3d modell in my CAD applikation, exported it to vrml, imported it into blender, designed a simple texture an exported it to 3ds.


I have created following files:
3ds file: https://dandee2.homelinux.net/~daniel/temp/xprs3.3ds
Texture: https://dandee2.homelinux.net/~daniel/temp/xprs3.jpg

Adding the texture in Blender looks like:
https://dandee2.homelinux.net/~daniel/temp/BlenderPic.jpg


With a simple loadinbg program from the samples the results look like:
With option calctexturewrap: https://dandee2.homelinux.net/~daniel/temp/calcTextureWrap.jpg

Without this option:
https://dandee2.homelinux.net/~daniel/temp/withoutcalctexturewrap.jpg

Other samples from jpct site are looking good (for example rock.3ds plus texture) so i think it has something to do with my texture or my 3ds but I am not so familar with that and maybe someone sees the problem directly.

Thank you for you help. Best regards from Bochum.

My code:
Code: [Select]
import com.threed.jpct.*;
import java.io.InputStream;
import java.util.logging.Level;
import javax.swing.*;
/**
 *
 * @author dslawaticki
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    private World world;
    private FrameBuffer buffer;
    private Object3D box;
    private JFrame frame;

    public static void main(String[] args) {
        try {
            new Main().loop();
        } catch (Exception ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
            
    }
    public Main() throws Exception {

frame=new JFrame("Hello world");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

world = new World();
world.setAmbientLight(200, 200, 200);

TextureManager.getInstance().addTexture("box", new Texture("D:\\Privat\\3DModelle\\xprs3.jpg"));
                System.out.println (TextureManager.getInstance().getTexture("box").getHeight());
                System.out.println (TextureManager.getInstance().getTexture("box").getWidth());

                box = loadModel("xprs3.3ds",1);
                box.setTexture("box");
                box.calcTextureWrap();
                box.recreateTextureCoords();

box.setEnvmapped(Object3D.ENVMAP_DISABLED);
    
world.addObject(box);

world.getCamera().setPosition(50, -50, -5);
world.getCamera().lookAt(box.getTransformedCenter());
              
}
        private Object3D loadModel(String filename, float scale) {
    InputStream in1 = getClass().getResourceAsStream(filename);
       Object3D[] model = Loader.load3DS(in1, scale);
       Object3D o3d = new Object3D(0);
       Object3D temp = null;
       for (int i = 0; i < model.length; i++) {
           temp = model[i];
           temp.setCenter(SimpleVector.ORIGIN);
           temp.rotateX((float)( -.5*Math.PI));
           temp.rotateMesh();
           temp.setRotationMatrix(new Matrix());
           o3d = Object3D.mergeObjects(o3d, temp);
           o3d.build();
       }
       return o3d;
   }

private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);

while (frame.isShowing()) {
//world.getCamera().setPosition(50, -50, -5);
                        box.rotateY(0.01f);
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.display(frame.getGraphics());
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
frame.dispose();
System.exit(0);
}

}

Pages: [1]