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

Pages: [1]
1
Support / Would a WebGL port be possible via GWT?
« on: April 15, 2013, 06:56:07 pm »
At the moment this is speculation, but I'd like feedback on how hard this would be as (with permission) its something I might like to try a few months from now.

I am a really big fan of Jpct, its made my Android project a lot easier.
I do a lot of web work as well, and it would be nice if I could leverage my knowledge of Jpct to make 3d web apps and games easily.

*WebGL is based on Open GL ES.

*GWT is a rather nice framework for writing Java and having it cross-compiled to Javascript.  It works well enough that you can normally reuse Java libs you might have, provided they are not intended for any visual or loading stuff. (I have, for example, shared a lot of semantic logic code between a Android app and a Web game)
https://developers.google.com/web-toolkit/

* Theres already libs for GWT that allow you to use WebGL in Java:
http://code.google.com/p/gwtgl/wiki/BindingTutorial
(essentially a 1:1 mapping of the Javascript functions)



So my thinking is that it should be possible to make a version of Jcpt which you can import into a GWT project. Essentially mapping the Open GL ES functions to their equivalent WebGL  Javascript functions.

Is this a mad dream?
Is it a insane amount of work?

Thoughts?

2
Not sure if anyone is interested but we have a earlier alpha of our Skywriter app concept:

http://code.google.com/p/skywriter/downloads/detail?name=skywriter5.apk&can=2&q=#makechanges

Its not too usefull but you can:

- Login with any XMPP/Jabber based account (like Google)
- Create a wave (which is a multi-user chatroom)
- Invite users.
- Post a billboard sprite with writing on at any location you see. (click and hold on the AR view and go "create" to make a billboard, then use +/- volume to adjust distance. Hold over the newly created item again and go "confirm" to add text and post)
- Any one in the room you posted it too can see it.
- You can create as many rooms as you like, different people in each, post to any of them, toggle visibility of each.

What you cant do:

- No persistence. As we are using XMPP, the app its currently limited to just seeing stuff posted if you are currently logged in. You log-out and its lost. Sorry :(   Think of it like IRC chat :P

Long term goal:

- To have this as a fully-featured open protocol, allowing anyone to make a browser for it.
- To have connections to WFP servers, allowing persistency.
- Support more elaborate AR models being created on the fly.  (you can actually already display full 3d models with textures by sending a ARWave link, but they need to be posted from a PC client, if anyone wants to try this out I will spec out the link format - its pretty simple).

3
Support / clearObject and rebuild? (trying to recreate a object)
« on: April 24, 2012, 10:12:05 pm »
I have a rectangle created with the following code:

Code: [Select]
public Rectangle (int quads, float scalex, float scaley) {

super(quads*quads*2+8);
this.quads = quads;

      createRect(quads, scalex, scaley);
   }



private void createRect(int quads, float scalex, float scaley) {

Log.i("text", "building for size: = "+scalex+","+scaley);


float startx=-scalex*(float) quads/2f;
      float starty=startx;
      float tx=0f;
      float ty=0f;
      float dtex=(1f/(float) quads);
      Object3D obj=this;
   
     
      for (int i=0; i<quads; i++) {
         for (int p=0; p<quads; p++) {
            float dtx=tx+dtex;
            float dty=ty+dtex;
            if (dtx>1f) {
               dtx=1f;
            }
            if (dty>1f) {
               dty=1f;
            }
            obj.addTriangle(new SimpleVector(startx, starty, 0), tx, ty, new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty, 0),
                            dtx, ty);
            obj.addTriangle(new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty+scaley, 0), dtx, dty, new SimpleVector(startx+scalex,
                            starty, 0), dtx, ty);
            startx+=scalex;
            tx+=dtex;
         }
         starty+=scaley;
         startx=-scalex*quads/2;
         tx=0;
         ty+=dtex;
      }
}


I wanted to be able to resize this rectangle in x/y at will, keeping its position/rotation the same, I thought I could do this with a simple clear and recreate like so:

Code: [Select]

/** rebuilds whole objec to rescale - pretty wastefull I think **/
public void setSize(float scalex, float scaley)

{ Log.i("text", "rebuilding for size: = "+scalex+","+scaley);

this.clearObject();
createRect(quads, scalex, scaley);
super.build();

}


But all that happens when I try to, say, increase its Y scale is the texture vanishes and the object stays its original size.
Any idea whats going on or how to diagnose further? :-/


4
Support / Seralised formats....universaly good for mobile engines?
« on: February 09, 2011, 02:49:56 pm »
Next week I'm going to a AR standards meeting;
http://www.perey.com/ARStandardsMeetingFeb2011.html

We are discusing with a few companies possible standards for Augmented Reality applications; both world/data link methods as well as formats used once that link is made.
Naturaly 3D formats for AR use is one of the most important things being discused, so I'm just seeking out feedback on (from a engine standpoint) what makes a good format.
With jpct I know seralisation speeds up loading....is this a "generic" good thing for formats on low end devices, or just specificly good for this engine?
Also, many are talking about markup based languages like expansions to VRML, ARML, KARML etc, as well as KML type stuff. Are these formats relatively "heavy" or not much of a problem given todays hardware?

This isn't specific requests about what jpct should support in the future, more just hypothicaly the sort of recomendations that would be usefull to make.

5
Support / Method to make objects stay the same size with distance?
« on: February 02, 2011, 02:10:50 pm »
I'm working on a little AR app, and it would be helpfull if there was a way to make billboard sprites not scale with distance.
That is, if they are far away they are the same size as near.

I figured theres two ways of doing this, and I wondered if anyone could give feedback on what seems the best and what sort of maths would be required;

1. Each time the camera moves scale all the billboard sprites to compansate.  This would mean mesuring their distance to then camera [insert formular] and scaleing based on that.

2. Drawing the sprites directly to the screen not using the 3D scene at all - obviously this takes care of the scaleing easily, but raise's issues such as drawing order and positioning.

I'm guessing number 1 will be more flexible, and 2 would be more efficiant in terms of cpu.
Number 1 would also let me scale by other methods too if I wished - like getting slightly smaller with distance rather then realisticly exponetialy smaller.
The camera in my app shouldn't be moving too much - walking pace in a city with gps updates probably means only once every few seconds at most.

So..and ideas on the direction I should take?



6
Feedback / Search in wiki unclickable in Chrome?
« on: December 11, 2010, 04:09:46 pm »
Anyone else having this problem;
http://www.jpct.net/wiki/index.php/Main_Page

The search box can't be clicked in.
Works fine in Opera.

7
Support / "Too many textures added to the TextureManager."
« on: September 17, 2010, 08:06:45 pm »
I'm trying to have lots of updateing textures in my project,and keep running into this error;

AndroidRuntime(22498): java.lang.RuntimeException: - ERROR: Too many textures added to the TextureManager. Adjust Config.maxTextures!

Heres my code for updating the texture;

Code: [Select]
private void updatedTexture(String Texturename, String text) {

Log.i("add", "update texture triggered with:"+Texturename+"|"+text);

paint.setColor(Color.BLACK);

Bitmap.Config config = Bitmap.Config.ARGB_8888;
FontMetricsInt fontMetrics = paint.getFontMetricsInt();
int fontHeight = fontMetrics.leading - fontMetrics.ascent
+ fontMetrics.descent;
int baseline = -fontMetrics.top;
int height = fontMetrics.bottom - fontMetrics.top;

// have to add multiline support here
Bitmap charImage = Bitmap.createBitmap(closestTwoPower((int) paint
.measureText(text) + 10), 32, config);

Canvas canvas = new Canvas(charImage);
canvas.drawColor(Color.WHITE);
canvas.drawText(text, 10, baseline, paint); // draw text with a margin
// of 10

TextureManager tm = TextureManager.getInstance();

Texture testtext = new Texture(charImage, true); // the true specifys
                        // the texture has
// its own alpha. If
// not, black is
// assumed to be
// alpha!

//

if (tm.containsTexture(Texturename)) {

Log.i("add", "updating texture="+Texturename);

tm.removeAndUnload(Texturename,fb);

Log.i("add", "updated texture="+Texturename);

tm.addTexture(Texturename, testtext);

} else {
tm.addTexture(Texturename, testtext);
}

}


Note the last bit.

Surely this should ensure the texture is replaced and thus not cause too many to form :? Instead I get my textures either turning completely white, or causing this error. (or both) after a few updates.

8
Support / How to have a ContextMenu on the GLSurfaceView :?
« on: September 06, 2010, 01:00:18 pm »
Probably a real newbie question, but I'm having a little trouble working out how to have a context menu working
in my GLSurfaceView view.
There doesn't seem to be a "onCreateOptionsMenu" or
"onOptionsItemSelected" to override. (or its protected)

I do notice a "setOnCreateContextMenuListener" but I don't know how to
use it.
Anyone know?

9
Support / Flicking 3d landscape...what am I doing wrong?
« on: August 30, 2010, 10:47:44 pm »
While working on my AR application I noticed the landscape often "flicked" at first I thought this was a sensor issue, but dismissed that after I found the problem is still there even with a completely static set of co-ordinates.
Heres a video of the problem;

http://www.youtube.com/watch?v=dphRVM4HXaM

Essentially every time the sensors update now, this code runs;

Code: [Select]
Camera worldcam = world.getCamera();

worldcam.getBack().setIdentity();

float Z = xyzAngles.z;
float Y = xyzAngles.y;
float X = xyzAngles.x;

//worldcam.rotateCameraAxis(new SimpleVector(0,1,0), -Z);
//worldcam.rotateCameraAxis(new SimpleVector(1,0,0), X);
//worldcam.rotateCameraAxis(new SimpleVector(0,0,1), -Y);

worldcam.rotateCameraAxis(new SimpleVector(0,1,0), -0.081920266f);
worldcam.rotateCameraAxis(new SimpleVector(1,0,0), 0.5303804f);
worldcam.rotateCameraAxis(new SimpleVector(0,0,1), 0.84379244f);


Any idea's what cause's the graphical glitch?

10
When loading some of my 3ds models into the engine, I noticed occasionally I got an effect where the texture effectively cut right though to the background. That is, things were not just transparent, but made everything behind them invisible too.
This was due, as far as I could tell, due to mapping errors in my 3d file.

However, its a useful effect and Id like to reproduce it.
Specifically, as I'm working on an AR application it would be a good way to "mask out" real world objects so that other 3d objects could be seen to go behind them.

So I wondered what texture setting is needed to reproduce this effect intentionally?

Hope I explained myself well enough, if not I'll do a picture to illustrate.

11
Support / 3DS Texture loading advice...
« on: August 11, 2010, 05:22:19 pm »
I'm wishing to load a textured 3ds model from a remote url.

Jpct does have this neat system, as I understand, that when the 3ds model is loaded it will automatically assign matching textures already in its memory. (that is, if the 3ds refers to a filename "text1.jpg" for the texture, and a texture with that name is in memory, it will add it).
Thats pretty cool.
The problem is, with my app the textures also have to be loaded dynamically, and their names wont be known in advance. So I cant easily preload them all in, then call to load the 3ds.

Ideally, I'd like to be able to point the app at a url, say;
http://www.darkflame.co.uk/building1/building.3ds
And the app looks at the 3ds file, see's what texture-names it has assigned, then looks in the same url directory for them
http://www.darkflame.co.uk/building1/texture1.jpg
http://www.darkflame.co.uk/building1/texture2.jpg

Is this possible?

The only other solution I see for my app is I point it at a file on the server that lists both the 3ds file and all its textures. Then it looks at that list and downloads the textures listed and then the 3ds file.


12
Support / Possibly to download/display a mesh at runtime?
« on: July 13, 2010, 05:00:02 pm »
Is it possible to download a mesh (say, OBJ or 3DS) at runtime and use this in a scene?

I assume you'd have to pre-download and then use it as a input-stream for Loader.load3DS, but I have no idea how to do this, or if its even possible.

Sorry if this has been asked before, btw, I tried searching but couldn't see anything.
Thanks,
Thomas

13
Support / getObjectByName crash's if no object with name exists?
« on: May 16, 2010, 04:10:52 pm »
getObjectByName() seems to crash if it cant find the object named....shouldn't it just return null?
Its easy enough to work around this,but I thought Id mention it as it seems to be a bug.

14
Support / How to get a texture from a FrameBuffer?
« on: May 15, 2010, 08:43:06 pm »
Trying to get a texture from a framebuffer but its coming out totally transparent/unset :?

Code: [Select]
//set up font
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTypeface(Typeface.create((String)null, Typeface.BOLD));
paint.setTextSize(16);
glFont = new GLFont(paint);


//created a new framebuffer to render the texture too
Texture textTexture = new Texture(60,60, RGBColor.BLACK);
FrameBuffer meep = new FrameBuffer(gl, 100, 100);

meep.setRenderTarget(textTexture);
meep.clear(RGBColor.BLACK);
glFont.blitString(meep, " test test test! ",
5, 5, 10, RGBColor.WHITE);
meep.display();

(that texture is then applied to a mesh, but it doesn't show up)

Probably something I'm not understanding about the process here.

Pages: [1]