Daily Archives

Articles indexed Wednesday June 22 2011

Page 4/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Switch from encrypted partition to unencrypted (Error: cryptsetup: evms_activate is not available)

    - by Chris Lercher
    I initially installed Ubuntu 11.04 with an encrypted file system (from the alternate install CD: Guided Partitioning, LVM encrypted). Now I wanted to change this setup to have my root file system on an unencrypted partition. I had the following setup before: /dev/mapper/my-root on / type ext4 (rw,noatime,errors=remount-ro,commit=0,commit=0) /dev/sda1 on /boot type ext2 (rw,noatime) I backed up /, reformatted /dev/sda5 (which had contained the encrypted LVM device) to an ext3 partition, and restored / to that partition. I edited /etc/fstab, removed the line /dev/mapper/my-root / ..., and added the line: /dev/sda5 / ext3 noatime,rw,errors=remount-ro,commit=0 0 1 I edited /etc/crypttab, and commented out the single entry. On reboot, I get the grub screen as usual, but then I get the message cryptsetup:evms_activate is not available, waiting for encrypted source device. I tried reinstalling Grub2 using a LiveCD with the ChRoot method, but that didn't make any difference. Why is Ubuntu still searching for an encrypted device?

    Read the article

  • Why are graphics so slow/jerky/lagged with an ATI 4250?

    - by Ben
    Never had a problem with Maverick, always very fast. I upgrade to Natty and the graphics seem to be very lagged. CPU, load, and memory usage is low, all graphics are choppy and lagged though. I have the proprietary driver installed and everything. Alt-Tabbing takes 3-5 seconds for the dialog to popup, zooming in with compiz zoom makes things very slow. I never had any of these problems with 10.10 Thanks

    Read the article

  • home-folder encryption: Does it work?

    - by jpaugh
    Back when Ubuntu first sported home folder encryption (what, around the time of Jaunty Jackalope?), I opted in. That caused me some grief when I decided to change my login password. I found that I couldn't decrypt my home anymore! In trying to fix this, I eventually muddled things to the point that using my old password didn't work anymore, either. That experience has left me very shy of using an encrypted home directory--nevermind the performance hit of encryption. Has this feature become more "stable" since it came out? Does it break if you change your login password? Has your [more recent] experience been better? (Does it work in Natty Narwhal?)

    Read the article

  • Playing a video logs me out

    - by Kartick Vaddadi
    When I try to play a video in vlc, totem or banshee, it immediately logs me out. Sometimes this happens when I try to full screen the video. This seems to happen only after upgrading to ubuntu 11, and happens for multiple kinds of files, like avi and m4v. The motherboard is Asus a8v-mx. Please help me fix my ubuntu installation. Thanks. Here are the relevant entries from syslog: 21:12:27 enlightenment kernel: [ 488.157457] powernow-k8: Hardware error - pending bit very stuck - no further pstate changes possible May 1 21:12:27 enlightenment kernel: [ 488.158634] powernow-k8: transition frequency failed May 1 21:12:27 enlightenment kernel: [ 488.264015] powernow-k8: failing targ, change pending bit set May 1 21:12:27 enlightenment kernel: [ 488.306466] agpgart-amd64 0000:00:00.0: AGP 3.0 bridge May 1 21:12:27 enlightenment kernel: [ 488.306489] agpgart-amd64 0000:00:00.0: putting AGP V3 device into 8x mode May 1 21:12:27 enlightenment kernel: [ 488.306562] pci 0000:01:00.0: putting AGP V3 device into 8x mode May 1 21:12:27 enlightenment kernel: [ 488.372044] powernow-k8: error - out of sync, fix 0x2 0xa, vid 0x4 0x4 May 1 21:12:27 enlightenment kernel: [ 488.372055] powernow-k8: ph2 null fid transition 0xa May 1 21:12:30 enlightenment rtkit-daemon[1304]: Successfully made thread 1987 of process 1987 (n/a) owned by '105' high priority at nice level -11. May 1 21:12:30 enlightenment rtkit-daemon[1304]: Supervising 1 threads of 1 processes of 1 users. May 1 21:12:30 enlightenment rtkit-daemon[1304]: Successfully made thread 1988 of process 1987 (n/a) owned by '105' RT at priority 5. May 1 21:12:30 enlightenment rtkit-daemon[1304]: Supervising 2 threads of 1 processes of 1 users. May 1 21:12:30 enlightenment rtkit-daemon[1304]: Successfully made thread 1989 of process 1987 (n/a) owned by '105' RT at priority 5. May 1 21:12:30 enlightenment rtkit-daemon[1304]: Supervising 3 threads of 1 processes of 1 users. May 1 21:12:32 enlightenment gdm-simple-greeter[1975]: Gtk-WARNING: /build/buildd/gtk+2.0-2.24.4/gtk/gtkwidget.c:5687: widget not within a GtkWindow May 1 21:12:32 enlightenment gdm-simple-greeter[1975]: WARNING: Unable to load CK history: no seat-id found May 1 21:12:34 enlightenment gdm-session-worker[1978]: GLib-GObject-CRITICAL: g_value_get_boolean: assertion `G_VALUE_HOLDS_BOOLEAN (value)' failed May 1 21:12:38 enlightenment gdm-session-worker[1978]: pam_sm_authenticate: Called May 1 21:12:38 enlightenment gdm-session-worker[1978]: pam_sm_authenticate: username = [rama] May 1 21:12:39 enlightenment rtkit-daemon[1304]: Successfully made thread 2108 of process 2108 (n/a) owned by '1000' high priority at nice level -11. May 1 21:12:39 enlightenment rtkit-daemon[1304]: Supervising 4 threads of 2 processes of 2 users. May 1 21:12:39 enlightenment pulseaudio[2108]: pid.c: Stale PID file, overwriting. May 1 21:12:39 enlightenment rtkit-daemon[1304]: Successfully made thread 2111 of process 2108 (n/a) owned by '1000' RT at priority 5. May 1 21:12:39 enlightenment rtkit-daemon[1304]: Supervising 5 threads of 2 processes of 2 users. May 1 21:12:39 enlightenment rtkit-daemon[1304]: Successfully made thread 2112 of process 2

    Read the article

  • Allow shutdown/restart if logged in another terminal

    - by user20415
    I have Natty installed. Howto allow shutdown/restart if other user logged in another terminal, for example using CTRL-ALT-DEL? I've tried to add the following lines in /etc/sudoers: user ALL=(root)NOPASSWD:/sbin/reboot user ALL=(root)NOPASSWD:/sbin/halt user ALL=(root)NOPASSWD:/sbin/shutdown and sudo chmod 750 /sbin/shutdown sudo chmod 750 /sbin/reboot or create /etc/shutdown.allow but it doesn't help and I still get Gnome login mask.

    Read the article

  • Executable execution path. Does it depends of the place the executable is called from?

    - by Valkea
    as I'm still a new Linux user, I still discover some behaviours and I'm unable to tell if they are "normals" or not. I searched the Internet but as I can't really find an answer I guess it's time to ask here. Few weeks ago I installed a small game called "Machinarium" and I played it... but few days later when I wanted to continue my game I was unable to make the game start correctly. And as I didn't had the time to search I given up. But yesterday as I was working on a program of mine, I had the exactly same behaviour. So I searched a bit and I discovered that when using Nautilus with the "List view", I was able to run the program (ie: the program does find the sound, images etc resources) when I was literally "inside" the executable folder, but unable when I was in a parent folder and expanding it to the executable folder to run it. To illustrate the behaviour here are two screen shots. It doesn't works if the executable is double clicked from here It does works if the executable is double clicked from here This is indeed the same "place", but the Nautilus view is slightly different as the current folder is not the same and it seems to make a difference for the program. Furthermore, when I create a menu items via System Settings/Main Menu to the executable, it behaves just like if the executable can't find the resources (that's why I was unable to play Machinarium the second time as I created a menu short-cut after my first game). So I asked my program to generate a text file at it's root when running, and I started to launch it from different "parent" folders to see where is generated the text file. Each time the file was generated on the top folder of the current Nautilus view. I was expected to see it appears in the same folder of the executable (well not as I was guessing what as happening, but before that I would have expected to see it appears in the exe folder). Does anyone can explain me why it does works like this (I guess it's normal) ? How I'm supposed to solve this when creating programs (Should I detect the executable path in my C++ code or should I organize the resources files another way than on windows ?)

    Read the article

  • how to get back the firefox apparmor profile after deleting it

    - by Judderwocky
    I deleted the apparmor profile for firefox when I was tinkering with it... and now I can't get it back. I uninstalled (complete) the apparmor program, profiles, etc. and when it reinstalled, i still don't get the profile back (ie. /etc/apparmor.d./usr.bin.firefox* ) I learned that the apparmor profile for firefox is actually a apart of the firefox package... but i uninstalled firefox and reinstalled it and i still didn't get the file usr.bin.firefox* ) Is there somewhere I can download the file manually?

    Read the article

  • Bluetooth pairing works in 10.10 but not in 11.04

    - by Nathan Haines
    My laptop, a Compaq Presario V2000, has a built-in Bluetooth module that has worked well since at least Ubuntu 8.04 LTS. I use it to pair with headphones and a mouse. These both worked great in Ubuntu 10.10 (and still do with a live CD) but I cannot pair to any Bluetooth device in Ubuntu 11.04, even from a live CD. I can see the Bluetooth module in lspci and when I try to set up a new device from the Bluetooth indicator my computer detects all Bluetooth devices around me but pairing always fails. At the moment I'm most concerned with getting my Microsoft Wireless Notebook Presenter Mouse 8000 paired. Relevant output of lspci: Bus 003 Device 002: ID 03f0:011d Hewlett-Packard Integrated Bluetooth Module

    Read the article

  • Monitor Display issue

    - by dsiddens
    When booting I will have to boot maybe 3 or 4 times to get a screen that is not displayed diagonally or is not using the full screen width. Hardware specification: HP s7727c with AMD64 and NVIDIA chipsets and Insignia 22" monitor/TV. The Ubuntu version is 9.10 Karmic. I'd like to stay current with Ubuntu on this machine, but have gone down to 9.10 to get this described functioning. I tried higher versions and could not get past the "black screen" I think this issue is connected to the NVIDIA chipset/driver problem. I am a GUI user and I don't follow the other solutions posted which make use of the command line. I suppose if the command line solution could be given without making any assumptions of the receiving person's knowledge base, then even I and others like me, could implement it. Thank you for your time and assistance. Doug

    Read the article

  • How does btrfs RAID work in degraded mode?

    - by turbo
    My idea was that (using loopback devices) it works like this Create the raid array sudo mkfs.btrfs -m raid1 -d raid1 /dev/loop1 /dev/loop2 You mount them sudo mount /dev/loop1 /mnt and mark them touch goodcondition You unmount and simulate disk failure (remove disk or delete loopback device loop2 in my case) You mount degraded -o degraded and mark again touch degraded You add the bad disk again sudo btrfs dev add /dev/loop2 You rebalance sudo btrfs fi ba /mnt And Raid 1 should work again. But that's not the case. sudo btrfs fi show: Total devices 3 FS bytes used 28.00KB devid 3 size 4.00GB used 264.00MB path /dev/loop1 devid 2 size 4.00GB used 272.00MB path /dev/loop2 *** Some devices missing The file degraded lives on loop1 but not on loop2 when loop2 is mounted in degraded mode. Why is that?

    Read the article

  • Installing 10.04 server on HP xw9400 Workstation with RAID 5

    - by Dave Long
    I have a workstation that was given to me that is a friggen powerhouse, so I figured I would set it up as my development and demo server. This is my first experience installing Ubuntu onto a RAID array and so far it has not been a fun one. I have been following the Advanced Installation guide for installing Ubuntu 10.04 server, and it says that there will be an option on the Partition Disks screen to manually create the partitions, but the only options I have are: Configure iSCSI volumes Undo changes to partitions Finish partitioning and write changes to disk Just before I got to that screen I got a message that said: One or more drives containing Serial ATA RAID configurations have been found. Do you wish to activate these RAID devices? It doesn't matter whether I answer yes or no to that, I still get the same Partition Disks screen. When I try to select Finish partitioning and write changes to disk I just get the No root file system error. Has anyone else experienced this, and how do I get past it? Can I not run Ubuntu on this machine?

    Read the article

  • My sound is not working

    - by gkhan
    I am not able to hear any sound. Does anyone have a clue how to proceed in fixing this? Issuing aplay gives this $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: NVidia [HDA NVidia], device 0: VT1708S Analog [VT1708S Analog] Subdevices: 2/2 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 card 0: NVidia [HDA NVidia], device 1: VT1708S Digital [VT1708S Digital] Subdevices: 1/1 Subdevice #0: subdevice #0

    Read the article

  • My computer has begun to restart after I upgraded

    - by Voidcode
    After updating to Ubuntu 11.04. My computer started to turn off and reboot. This happens about every half hour, I think there is a tendency to happen when I work with multiple applications at once. It is both my Desktop and Labtop. I has installed- BOINE Manager, PlayOnLinix GIMP, Qt, Wine, VLC-player, Blender 2.57 Otherwise is all as default. Update: See my /var/log/kern.log.1 here: http://paste.ubuntu.com/608690

    Read the article

  • After 10.10 -> 11.04 upgrade, can only login via Classic (No Effects)

    - by Ryan P.
    Yesterday I upgraded from 10.10 to 11.04, everything seemed to go okay until immediately after login: the desktop goes into a "corrupted" looking state (similar to having too high resolution set). I can see some kind of movement by moving the mouse around/right clicking, and can enter text terminals via ctrl + alt + f1 It does this in both plain "Ubuntu" and "Ubuntu Classic", and only seems to login/startup properly with Ubuntu Classic (No Effects). I have checked my video card (Radeon X600) and run the unity support test which passes with all "yes" results (Unity supported: yes): /usr/lib/nux/unity_support_test -p I have tried re-installing my Ubuntu desktop: rm -rf .gnome .gnome2 .gconf .gconfd .metacity sudo apt-get remove ubuntu-desktop sudo apt-get install ubuntu-desktop With no success. I can workaround for now with Classic (No Effects), but I'd really like to find the root problem. Any suggestions on what else to try would be appreciated!

    Read the article

  • Solution for payment gateway with multiple sellers

    - by pvieira
    I'm looking for a payment gateway that can be used in a website with multiple sellers. Let's say that depending on the purchased item, a given seller/merchant should receive the money. Would that be possible using only one "master merchant" account that would act as a "distributor" of funds for several "sub-merchants"? Does any well established privider (paypal, worldpay, auth.net, etc) supports this?

    Read the article

  • Directory access control with Apache: do I need to use a specific .htaccess?

    - by Mirror51
    I have an Apache webserver, and in the Apache configuration, I have Alias /backups "/backups" <Directory "/backups"> AllowOverride None Options Indexes Order allow,deny Allow from all </Directory> I can access files via http://127.0.0.1/backups. The problem is everyone can access that. I have a web interface, e.g. http://localhost/adminm that is protected with htaccess and password. Now I don't want separate .htaccess and .htpasswd for /backups, and I don't want a second password prompt when a user clicks on /backups in the web interface. Is there any way to use same .htaccess and .htpasswd for the backups directory?

    Read the article

  • How can I superscript a single character throughout my site?

    - by dvn66
    Finishing up development work for a client and they have a late request to superscript every occurrence of the &reg character throughout the site. I merely get by with CSS, but not even sure CSS provides the best solution here. how can I make a global change to every occurrence of a single character in the site copy without going back and adding tags everywhere? if the best solution does involve inserting a span or other tag I'm thinking it could be accomplished with a database query (all the copy is wired up to a CMS).

    Read the article

  • Webmaster tools showing 404 for non existent folder pages

    - by Jody
    Google webmaster tools is reporting some/many 404 urls that don't exist on my site. The links are things such as domain.com/xyz/ However that doesn't exist, but domain.com/xyz/index.html does exist. The "linked from" pages all show proper links to the "/xyz/index.html". The page without index.html DOES 404, but why is google even trying these urls if they are not linked to? My real question, is there a way to have google stop attempting to load these pages, and ultimately remove these from the crawl errors report. Thanks.

    Read the article

  • Broken Links in different browsers

    - by kdorival
    Hi I'm having problems with our website, http://www.accessiblehomehealthcare.com, which is a wordpress 2.7 (version). All of a sudden our RSS links broke on the right side, which has happened before and I fixed it within 5 mins. Now, when I fix it, it doesn't look right in different version of I.E. or Firefox, I have I.E. 8 and Firefox 3.6.15 and it looks good for the most part, but there are a few parts where the links are broken. One browser the links would look ok but go to another page and the links or logos would be broken. Certain parts of the website should be static(identical) to the other pages of the site, but if a link is broken on one page, its perfect on another page. I was wondering was there a secret code for wordpress to keep the sites compatible with all browser versions or is there a bigger issue???? Any help or suggestions will help???

    Read the article

  • Java hosting service provider?

    - by Rahul Utb
    I want to host a Java web application. How to decide which hosting service provider to choose from. Is there any source of info where from I can get such info. Yes most important, being from India which service provider service should I use, from those who say there servers are located in US or they who say their servers are located in India itself. Thanks in advance from any suggestion/reply to this query.

    Read the article

  • Drawing particles as a smooth blob

    - by Nömmik
    I'm new to game/graphics development and I'm playing around with particles (in 2D). I want to draw particles close to each other as a blob, just as liquid/water. I do not want to draw big circles overlapping as the blob won't be smooth (and too big). I don't really know physics but I assume what I want is something looking similar to surface tension. I haven't been able to find anything on stackexchange or on Google (maybe I do not know the correct keywords?). So far I have found two possible solutions, but I am unable to find any concrete information about algorithms. One of them is to calculate the concave hull of particles I consider being a blob. I can calculate the blob by creating an equivalence class (on the relation "close to each other"). Strangely enough I haven't been able to find any algorithm explaining how to calculate the concave hull. Many posts (and among stackexchange) links to libraries or commercial products that do this (I need libraries to work in C#), but never any algorithm. Also this solution might have a problem with a circle of particles, which would not detect the empty space in the middle. While researching concave hull I stumbled upon something called alpha shapes. Which seems to be exactly what I want to do, however just as with concave hull I haven't found any source explaining how they actually work. I have found some presentation materials but not enough to go on. It's like a big secret everyone knows except me :-/ After calculating the concave hull or alpha shape I want to make it a Bézier curve to make it smooth and nice. Although I do find my approach a bit too complex, maybe I am trying to solve this the wrong way? If you can either suggest any other solution to my problem, or explain the pieces I am missing I would be very happy and grateful :-) Thanks.

    Read the article

  • Will you still play a good Red Alert 3 mission map? [closed]

    - by W.N.
    I've been creating a RA3 mission map (play in Skirmish), most likely a remake of RA2 Yuri "To the Moon" mission, with more interesting elements. However, because of my work, the process was corrupted for more than a year. And now, I see that very few people still play RA3. So, should I continue making this map? Because there're still a lot of work to complete this map. I can assure you, the mission will be interesting. However, if few people play it, there's no need to waste time to it. Please give me some advice. Thank you.

    Read the article

  • Converting 2D Physics to 3D.

    - by static void main
    I'm new to game physics and I am trying to adapt a simple 2D ball simulation for a 3D simulation with the Java3D library. I have this problem: Two things: 1) I noted down the values generated by the engine: X/Y are too high and minX/minY/maxY/maxX values are causing trouble. Sometimes the balls are drawing but not moving Sometimes they are going out of the panel Sometimes they're moving on little area Sometimes they just stick at one place... 2) I'm unable to select/define/set the default correct/suitable values considering the 3D graphics scaling/resolution while they are set with respect to 2D screen coordinates, that is my only problem. Please help. This is the code: public class Ball extends GameObject { private float x, y; // Ball's center (x, y) private float speedX, speedY; // Ball's speed per step in x and y private float radius; // Ball's radius // Collision detected by collision detection and response algorithm? boolean collisionDetected = false; // If collision detected, the next state of the ball. // Otherwise, meaningless. private float nextX, nextY; private float nextSpeedX, nextSpeedY; private static final float BOX_WIDTH = 640; private static final float BOX_HEIGHT = 480; /** * Constructor The velocity is specified in polar coordinates of speed and * moveAngle (for user friendliness), in Graphics coordinates with an * inverted y-axis. */ public Ball(String name1,float x, float y, float radius, float speed, float angleInDegree, Color color) { this.x = x; this.y = y; // Convert velocity from polar to rectangular x and y. this.speedX = speed * (float) Math.cos(Math.toRadians(angleInDegree)); this.speedY = speed * (float) Math.sin(Math.toRadians(angleInDegree)); this.radius = radius; } public void move() { if (collisionDetected) { // Collision detected, use the values computed. x = nextX; y = nextY; speedX = nextSpeedX; speedY = nextSpeedY; } else { // No collision, move one step and no change in speed. x += speedX; y += speedY; } collisionDetected = false; // Clear the flag for the next step } public void collideWith() { // Get the ball's bounds, offset by the radius of the ball float minX = 0.0f + radius; float minY = 0.0f + radius; float maxX = 0.0f + BOX_WIDTH - 1.0f - radius; float maxY = 0.0f + BOX_HEIGHT - 1.0f - radius; double gravAmount = 0.9811111f; double gravDir = (90 / 57.2960285258); // Try moving one full step nextX = x + speedX; nextY = y + speedY; System.out.println("In serializedBall in collision."); // If collision detected. Reflect on the x or/and y axis // and place the ball at the point of impact. if (speedX != 0) { if (nextX > maxX) { // Check maximum-X bound collisionDetected = true; nextSpeedX = -speedX; // Reflect nextSpeedY = speedY; // Same nextX = maxX; nextY = (maxX - x) * speedY / speedX + y; // speedX non-zero } else if (nextX < minX) { // Check minimum-X bound collisionDetected = true; nextSpeedX = -speedX; // Reflect nextSpeedY = speedY; // Same nextX = minX; nextY = (minX - x) * speedY / speedX + y; // speedX non-zero } } // In case the ball runs over both the borders. if (speedY != 0) { if (nextY > maxY) { // Check maximum-Y bound collisionDetected = true; nextSpeedX = speedX; // Same nextSpeedY = -speedY; // Reflect nextY = maxY; nextX = (maxY - y) * speedX / speedY + x; // speedY non-zero } else if (nextY < minY) { // Check minimum-Y bound collisionDetected = true; nextSpeedX = speedX; // Same nextSpeedY = -speedY; // Reflect nextY = minY; nextX = (minY - y) * speedX / speedY + x; // speedY non-zero } } speedX += Math.cos(gravDir) * gravAmount; speedY += Math.sin(gravDir) * gravAmount; } public float getSpeed() { return (float) Math.sqrt(speedX * speedX + speedY * speedY); } public float getMoveAngle() { return (float) Math.toDegrees(Math.atan2(speedY, speedX)); } public float getRadius() { return radius; } public float getX() { return x; } public float getY() { return y; } public void setX(float f) { x = f; } public void setY(float f) { y = f; } } Here's how I'm drawing the balls: public class 3DMovingBodies extends Applet implements Runnable { private static final int BOX_WIDTH = 800; private static final int BOX_HEIGHT = 600; private int currentNumBalls = 1; // number currently active private volatile boolean playing; private long mFrameDelay; private JFrame frame; private int currentFrameRate; private Ball[] ball = new Ball[currentNumBalls]; private Random rand; private Sphere[] sphere = new Sphere[currentNumBalls]; private Transform3D[] trans = new Transform3D[currentNumBalls]; private TransformGroup[] objTrans = new TransformGroup[currentNumBalls]; public 3DMovingBodies() { rand = new Random(); float angleInDegree = rand.nextInt(360); setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse .getPreferredConfiguration(); Canvas3D c = new Canvas3D(config); add("Center", c); ball[0] = new Ball(0.5f, 0.0f, 0.5f, 0.4f, angleInDegree, Color.yellow); // ball[1] = new Ball(1.0f, 0.0f, 0.25f, 0.8f, angleInDegree, // Color.yellow); // ball[2] = new Ball(0.0f, 1.0f, 0.15f, 0.11f, angleInDegree, // Color.yellow); trans[0] = new Transform3D(); // trans[1] = new Transform3D(); // trans[2] = new Transform3D(); sphere[0] = new Sphere(0.5f); // sphere[1] = new Sphere(0.25f); // sphere[2] = new Sphere(0.15f); // Create a simple scene and attach it to the virtual universe BranchGroup scene = createSceneGraph(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); startSimulation(); } public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); for (int i = 0; i < currentNumBalls; i++) { // Create a simple shape leaf node, add it to the scene graph. objTrans[i] = new TransformGroup(); objTrans[i].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D pos1 = new Transform3D(); pos1.setTranslation(randomPos()); objTrans[i].setTransform(pos1); objTrans[i].addChild(sphere[i]); objRoot.addChild(objTrans[i]); } BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); Color3f light1Color = new Color3f(1.0f, 0.0f, 0.2f); Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f); DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction); light1.setInfluencingBounds(bounds); objRoot.addChild(light1); // Set up the ambient light Color3f ambientColor = new Color3f(1.0f, 1.0f, 1.0f); AmbientLight ambientLightNode = new AmbientLight(ambientColor); ambientLightNode.setInfluencingBounds(bounds); objRoot.addChild(ambientLightNode); return objRoot; } public void startSimulation() { playing = true; Thread t = new Thread(this); t.start(); } public void stop() { playing = false; } public void run() { long previousTime = System.currentTimeMillis(); long currentTime = previousTime; long elapsedTime; long totalElapsedTime = 0; int frameCount = 0; while (true) { currentTime = System.currentTimeMillis(); elapsedTime = (currentTime - previousTime); // elapsed time in // seconds totalElapsedTime += elapsedTime; if (totalElapsedTime > 1000) { currentFrameRate = frameCount; frameCount = 0; totalElapsedTime = 0; } for (int i = 0; i < currentNumBalls; i++) { ball[i].move(); ball[i].collideWith(); drawworld(); } try { Thread.sleep(88); } catch (Exception e) { e.printStackTrace(); } previousTime = currentTime; frameCount++; } } public void drawworld() { for (int i = 0; i < currentNumBalls; i++) { printTG(objTrans[i], "SteerTG"); trans[i].setTranslation(new Vector3f(ball[i].getX(), ball[i].getY(), 0.0f)); objTrans[i].setTransform(trans[i]); } } private Vector3f randomPos() /* * Return a random position vector. The numbers are hardwired to be within * the confines of the box. */ { Vector3f pos = new Vector3f(); pos.x = rand.nextFloat() * 5.0f - 2.5f; // -2.5 to 2.5 pos.y = rand.nextFloat() * 2.0f + 0.5f; // 0.5 to 2.5 pos.z = rand.nextFloat() * 5.0f - 2.5f; // -2.5 to 2.5 return pos; } // end of randomPos() public static void main(String[] args) { System.out.println("Program Started"); 3DMovingBodiesbb = new 3DMovingBodies(); bb.addKeyListener(bb); MainFrame mf = new MainFrame(bb, 600, 400); } }

    Read the article

  • Experience embedding javascript

    - by deft_code
    I'm looking into scripting languages to embed in my game. I've always assumed Lua was the best choice, but I've read some recent news about embedding V8 as was considering using it instead. My question is two fold: Does anyone with experience embedding v8 (or another javascript engine) recommend it? How does it compare with embedding Lua? I like that v8 has a c++ embedding API. However Lua API has had lots of time to be refined (newer isn't always better and all that). Note: At this point I'm not too concerned with which is better language or which library has better performance. I'm only asking about ease of embedding.

    Read the article

  • Coordinate based travel through multi-line path over elapsed time

    - by Chris
    I have implemented A* Path finding to decide the course of a sprite through multiple waypoints. I have done this for point A to point B locations but am having trouble with multiple waypoints, because on slower devices when the FPS slows and the sprite travels PAST a waypoint I am lost as to the math to switch directions at the proper place. EDIT: To clarify my path finding code is separate in a game thread, this onUpdate method lives in a sprite like class which happens in the UI thread for sprite updating. To be even more clear the path is only updated when objects block the map, at any given point the current path could change but that should not affect the design of the algorithm if I am not mistaken. I do believe all components involved are well designed and accurate, aside from this piece :- ) Here is the scenario: public void onUpdate(float pSecondsElapsed) { // this could be 4x speed, so on slow devices the travel moved between // frames could be very large. What happens with my original algorithm // is it will start actually doing circles around the next waypoint.. pSecondsElapsed *= SomeSpeedModificationValue; final int spriteCurrentX = this.getX(); final int spriteCurrentY = this.getY(); // getCoords contains a large array of the coordinates to each waypoint. // A waypoint is a destination on the map, defined by tile column/row. The // path finder converts these waypoints to X,Y coords. // // I.E: // Given a set of waypoints of 0,0 to 12,23 to 23, 0 on a 23x23 tile map, each tile // being 32x32 pixels. This would translate in the path finder to this: // -> 0,0 to 12,23 // Coord : x=16 y=16 // Coord : x=16 y=48 // Coord : x=16 y=80 // ... // Coord : x=336 y=688 // Coord : x=336 y=720 // Coord : x=368 y=720 // // -> 12,23 to 23,0 -NOTE This direction change gives me trouble specifically // Coord : x=400 y=752 // Coord : x=400 y=720 // Coord : x=400 y=688 // ... // Coord : x=688 y=16 // Coord : x=688 y=0 // Coord : x=720 y=0 // // The current update index, the index specifies the coordinate that you see above // I.E. final int[] coords = getCoords( 2 ); -> x=16 y=80 final int[] coords = getCoords( ... ); // now I have the coords, how do I detect where to set the position? The tricky part // for me is when a direction changes, how do I calculate based on the elapsed time // how far to go up the new direction... I just can't wrap my head around this. this.setPosition(newX, newY); }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >