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

Pages: 1 ... 6 7 [8] 9 10 ... 58
106
Support / Re: lighting mode and ambient light
« on: September 25, 2010, 01:38:14 am »
What color and shade is the original png image, and what shade are you using for the additional color?  I would try starting with a darker green png image for the texture and using a darker green for the additional color as well to see if you can get it down to the total brightness and color you are looking for.

107
Support / Re: How load "images" in the window?
« on: September 17, 2010, 09:58:55 pm »
If you are able to use some 3rd-party library to capture the video frames into instances of java.awt.Image, you can use a texture effect implementation and java.awt.image.PixelGrabber to create a "video texture".  One way is with JMF, as I did in this thread and this one.  JMF doesn't work on the Android, though, so if you need this for a jPCT-AE project, you'll need something else.  I am currently looking into the possibility of grabbing frames from a MediaPlayer into Bitmap instances to either be used in a texture effect or swapping out a Texture (no idea how fast this will would work on a phone, though).

108
Support / Re: Animated GIFs
« on: September 12, 2010, 06:11:50 am »
While looking though the jPCT-AE javadoc, I saw that Textures can be made from Bitmap instances, which basically have all the functions needed to easily port my GIF loader to jPCT-AE.  It only took about 30 minutes once I figured out how to use the Android SDK (this was my first real Android project).  It seems to run quite well - no serious performance issues that I can detect (although my example is very simple)

Example App  (source code)

109
Support / Re: Changing u/v coordinates on the fly
« on: September 12, 2010, 05:53:42 am »
NVM, I figured it out.  Need to call touch() after the u/v coordinates change.

110
Support / Changing u/v coordinates on the fly
« on: September 12, 2010, 05:37:01 am »
I have several quads for which I want to change their textures' u/v coordinates periodically.  What is the proper way to do this in jPCT-AE?

Currently, I am calling build( false ) on the Object3D, then to change the u/v coordinates:

Code: [Select]
                tex1 = new TextureInfo(
                          TextureManager.getInstance().getTextureID( "Front" ),
                          quadUVs.u1, quadUVs.v1, quadUVs.u2, quadUVs.v2,
                          quadUVs.u3, quadUVs.v3 );
                tex2 = new TextureInfo(
                          TextureManager.getInstance().getTextureID( "Front" ),
                          quadUVs.u3, quadUVs.v3, quadUVs.u4, quadUVs.v4,
                          quadUVs.u1, quadUVs.v1 );
                gifBox.getPolygonManager().setPolygonTexture( polyIdOffset,
                                                              tex1 );
                gifBox.getPolygonManager().setPolygonTexture( polyIdOffset + 1,
                                                              tex2 );
quadUVs is just a simple class that holds 8 floats to represent the u/v coordinates of the four corners of a rectangle.  These values are changed periodically.  I pulled the code out of a previous normal jPCT project, so I'm pretty sure I'm using the correct u/v values.  However, if there is nothing obvious you can think of that I need to do to make u/v changes work, I'll try and create a simpler test-case to look at.

111
Support / Re: Anyone use Netbeans?
« on: September 12, 2010, 03:57:32 am »
That did the trick.  Was able to install the ADT plugin without a hitch, then copy/paste from my Netbeans project.  Runs on both emulator and actual device.

As a side note, it seems rather odd to me that the Android SDK is not better supported on Netbeans.  I know more people use Eclipse, but Netbeans is also widely used.  Oh well, I'll just have to use Eclipse for my Android projects, and Netbeans for everything else (no point in trying to transfer several hundred Netbeans projects over to a new IDE, and I don't want to forget which IDE I wrote something in either).

112
Support / Re: Anyone use Netbeans?
« on: September 12, 2010, 03:21:30 am »
Haha, and don't say short answer is switch to Windows...

113
Support / Re: Anyone use Netbeans?
« on: September 12, 2010, 03:16:13 am »
Ok, the switch to Eclipse isn't going so well either.  I installed it, and went to add the ADT plug-in using the procedure outlined here.  However, after it asks me if I want to trust the digital signature, installation fails with the error message:
Quote
An error occurred while installing the items
  session context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Install, operand=null --> [R]org.eclipse.pde 3.4.100.v201002111343, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).
  Cannot connect to keystore.
  This trust engine is read only.
  The artifact file for osgi.bundle,org.eclipse.pde,3.4.100.v201002111343 was not found.

Some googling seems to indicate that the problem is that by default, the Eclipse which is packaged with Ubuntu runs with the GCJ JVM and not the JVM supplied by Sun Microsystems even if you have installed the Sun Microsystems version.  Every single reference I can find says the same thing:
Quote
edit the /etc/eclipse/java_home file and add the following line at the top:
/usr/lib/jvm/java-6-sun

Problem is, there is no /etc/eclipse directory, so no java_home file to edit.  I'm guessing some really-smart Eclipse developer switched things around in a recent version, making the hundreds of existing "how to's" on the subject useless.  Has anyone recently installed Eclipse and the ADT plugin on Ubuntu?

114
Support / Re: Anyone use Netbeans?
« on: September 12, 2010, 01:59:55 am »
I should point out that running these apk's on my actual Droid X behaves the same way as in the emulator, which would indicate there is a problem with how I am creating them, rather than a problem with the emulator.

115
Support / Anyone use Netbeans?
« on: September 12, 2010, 01:51:09 am »
For no other reason than I really hate to learn a new IDE, I've been using Netbeans to develop for Android (using the NBAndroid plug-in) rather than Eclipse.  There was one issue with audio that I noticed, caused by Netbeans zipping the contents of the res/raw directory rather than leaving them uncompressed.  This was easily fixed by adding a few lines to the build.xml file.  I have compiled a number of simple non jPCT-AE programs and successfully run them on my emulator's Droid X AVD (Android 2.1 update 1, WVGA8554, 16GB virtual sdcard).

Unfortunately, I am not having any luck with jPCT-AE.  I've tried both the Hello World from the wiki as well as the Demo.  When I run either of them, with or without the build.xml changes, the emulator's screen goes black for a split second then returns to the home screen.  Anyone have some suggestions for me to try? (I may have to give in and switch to Eclipse..).  Is there a log file for the emulator that gets generated or some other way to see if errors occurred (nothing appears in the Netbeans output window, because the program builds successfully and gets sent to the emulator without problems)

116
Support / Re: Animated GIFs
« on: September 10, 2010, 11:53:41 pm »
Reading and processing the GIF information from the file should work fine on Android without modification, because it's based on my own GIF loading code that I wrote some time ago in C++ (so it isn't Java-specific).  The part that won't work on Android is the drawing stuff (the part where I take the loaded information and use it to generate instances of java.awt.image.BufferedImage for each frame of the GIF).  What you need to be able to do is create 2D images with transparency on Android.  With that knowledge, you should be able to work with Egon to figure out how to use those images to create Texture instances in jPCT.  From there, it should be pretty easy to port the code over (in fact, I'll do the port for you if you do the initial research).

An alternative method would be to download the sourcecode for a JRE, such as OpenJDK, and pull out just the .java files you need to make my GIFImage class work as-is without modification (this would probably be more tedious than the first option, I'm guessing).

As for speed, I'm not sure how it would perform on Android.  It switches frames by changing the u/v coordinates on a "mosaic texture" containing all the frames in tiles.  This works quite fast in normal jPCT (much better than using a texture effect), but I have no idea how fast u/v changes are on AE version.  Changing it to use texture effects instead would be fairly easy (I've already written such a version of GIF loading for normal jPCT on this thread).  Obviously this method would also require the changes I mentioned above before it would work on Android.

117
Support / Re: How to rotate 3D object?
« on: September 08, 2010, 11:32:48 am »
A couple of things I noticed are that you haven't called 'build' on the object nor added it to the world.  Are you able to see the object at all?  As I mentioned in a previous thread, I haven't used the AE version of jPCT yet, but I would guess those are still required steps.

118
Support / Re: How to rotate 3D object?
« on: September 08, 2010, 06:10:50 am »
I assume the back of the box looks different than the front?

119
Support / Re: How to draw line in 3D
« on: September 07, 2010, 10:00:31 pm »
A "quick and dirty" way of drawing lines is with perpendicular intersecting quads.  Note that these "lines" will have an apparent width, i.e. they appear thicker when close to the viewer and thinner when further away.  Also note that if the line is super-long the ordering may turn out incorrect (in which case dividing it into smaller line-segments should work better).  Here is one possible way to create such a line.  I'm writing it off the top of my head, so there may be typos, but it should be enough to give you the general idea.  Also, for jPCT AE, you'll need to use whatever is the equivalent to java.awt.Color (I haven't written anything for the AE version yet):

Code: [Select]
// note: you will need to define a texture ahead of time.  For a solid-color line, you could use something like:
// TextureManager.getInstance().addTexture( "Red", new Texture( 8, 8, java.awt.Color.Red ) );

public Object3D createLine (SimpleVector pointA, SimpleVector pointB, float width, String textureName)
{
    Object3D line = new Object3D( 8 );
    float offset = width / 2.0f;

    // Quad A:
    line.addTriangle( new SimpleVector( pointA.x, pointA.y - offset, pointA.z ), 0, 0,
                     new SimpleVector( pointA.x, pointA.y + offset, pointA.z ), 0, 1,
                     new SimpleVector( pointB.x, pointB.y + offset, pointB.z ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    line.addTriangle( new SimpleVector( pointB.x, pointB.y + offset, pointB.z ), 0, 0,
                     new SimpleVector( pointB.x, pointB.y - offset, pointB.z ), 0, 1,
                     new SimpleVector( pointA.x, pointA.y - offset, pointA.z ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    // Quad A, back-face:
    line.addTriangle( new SimpleVector( pointB.x, pointB.y - offset, pointB.z ), 0, 0,
                     new SimpleVector( pointB.x, pointB.y + offset, pointB.z ), 0, 1,
                     new SimpleVector( pointA.x, pointA.y + offset, pointA.z ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    line.addTriangle( new SimpleVector( pointA.x, pointA.y + offset, pointA.z ), 0, 0,
                     new SimpleVector( pointA.x, pointA.y - offset, pointA.z ), 0, 1,
                     new SimpleVector( pointB.x, pointB.y - offset, pointB.z ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    // Quad B:
    line.addTriangle( new SimpleVector( pointA.x, pointA.y, pointA.z + offset ), 0, 0,
                     new SimpleVector( pointA.x, pointA.y, pointA.z - offset ), 0, 1,
                     new SimpleVector( pointB.x, pointB.y, pointB.z - offset ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    line.addTriangle( new SimpleVector( pointB.x, pointB.y, pointB.z - offset ), 0, 0,
                     new SimpleVector( pointB.x, pointB.y, pointB.z + offset ), 0, 1,
                     new SimpleVector( pointA.x, pointA.y, pointA.z + offset ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    // Quad B, back-face:
    line.addTriangle( new SimpleVector( pointB.x, pointB.y, pointB.z + offset ), 0, 0,
                     new SimpleVector( pointB.x, pointB.y, pointB.z - offset ), 0, 1,
                     new SimpleVector( pointA.x, pointA.y, pointA.z - offset ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );
    line.addTriangle( new SimpleVector( pointA.x, pointA.y, pointA.z - offset ), 0, 0,
                     new SimpleVector( pointA.x, pointA.y, pointA.z + offset ), 0, 1,
                     new SimpleVector( pointB.x, pointB.y, pointB.z + offset ), 1, 1,
                     TextureManager.getInstance().getTextureID( textureName ) );

    // If you don't want the line to react to lighting:
    line.setLighting( Object3D.LIGHTING_NO_LIGHTS );
    line.setAdditionalColor( java.awt.Color.White );

    // done
    return line;
}

Upon consideration, this method might also have trouble with lines that run more or less straight along the y-axis when viewed from the z-axis, and vice-versa.  A better way would be to create a line with the proper length along say the x-axis, and then rotate/translate it into place (I'm not ambitious enough to write that at the moment).

120
Support / Re: How to set UpVector of camera?
« on: September 01, 2010, 08:08:05 pm »
Also, make sure your vecCameraTarget vector is normalized, and also make sure that it forms a right-angle with whatever up-vector you use.

Pages: 1 ... 6 7 [8] 9 10 ... 58