Search Results

Search found 503 results on 21 pages for 'fx'.

Page 10/21 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • 2D Selective Gaussian Blur

    - by Joshua Thomas
    I am attempting to use Gaussian blur on a 2D platform game, selectively blurring specific types of platforms with different amounts. I am currently just messing around with simple test code, trying to get it to work correctly. What I need to eventually do is create three separate render targets, leave one normal, blur one slightly, and blur the last heavily, then recombine on the screen. Where I am now is I have successfully drawn into a new render target and performed the gaussian blur on it, but when I draw it back to the screen everything is purple aside from the platforms I drew to the target. This is my .fx file: #define RADIUS 7 #define KERNEL_SIZE (RADIUS * 2 + 1) //----------------------------------------------------------------------------- // Globals. //----------------------------------------------------------------------------- float weights[KERNEL_SIZE]; float2 offsets[KERNEL_SIZE]; //----------------------------------------------------------------------------- // Textures. //----------------------------------------------------------------------------- texture colorMapTexture; sampler2D colorMap = sampler_state { Texture = <colorMapTexture>; MipFilter = Linear; MinFilter = Linear; MagFilter = Linear; }; //----------------------------------------------------------------------------- // Pixel Shaders. //----------------------------------------------------------------------------- float4 PS_GaussianBlur(float2 texCoord : TEXCOORD) : COLOR0 { float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); for (int i = 0; i < KERNEL_SIZE; ++i) color += tex2D(colorMap, texCoord + offsets[i]) * weights[i]; return color; } //----------------------------------------------------------------------------- // Techniques. //----------------------------------------------------------------------------- technique GaussianBlur { pass { PixelShader = compile ps_2_0 PS_GaussianBlur(); } } This is the code I'm using for the gaussian blur: public Texture2D PerformGaussianBlur(Texture2D srcTexture, RenderTarget2D renderTarget1, RenderTarget2D renderTarget2, SpriteBatch spriteBatch) { if (effect == null) throw new InvalidOperationException("GaussianBlur.fx effect not loaded."); Texture2D outputTexture = null; Rectangle srcRect = new Rectangle(0, 0, srcTexture.Width, srcTexture.Height); Rectangle destRect1 = new Rectangle(0, 0, renderTarget1.Width, renderTarget1.Height); Rectangle destRect2 = new Rectangle(0, 0, renderTarget2.Width, renderTarget2.Height); // Perform horizontal Gaussian blur. game.GraphicsDevice.SetRenderTarget(renderTarget1); effect.CurrentTechnique = effect.Techniques["GaussianBlur"]; effect.Parameters["weights"].SetValue(kernel); effect.Parameters["colorMapTexture"].SetValue(srcTexture); effect.Parameters["offsets"].SetValue(offsetsHoriz); spriteBatch.Begin(0, BlendState.Opaque, null, null, null, effect); spriteBatch.Draw(srcTexture, destRect1, Color.White); spriteBatch.End(); // Perform vertical Gaussian blur. game.GraphicsDevice.SetRenderTarget(renderTarget2); outputTexture = (Texture2D)renderTarget1; effect.Parameters["colorMapTexture"].SetValue(outputTexture); effect.Parameters["offsets"].SetValue(offsetsVert); spriteBatch.Begin(0, BlendState.Opaque, null, null, null, effect); spriteBatch.Draw(outputTexture, destRect2, Color.White); spriteBatch.End(); // Return the Gaussian blurred texture. game.GraphicsDevice.SetRenderTarget(null); outputTexture = (Texture2D)renderTarget2; return outputTexture; } And this is the draw method affected: public void Draw(SpriteBatch spriteBatch) { device.SetRenderTarget(maxBlur); spriteBatch.Begin(); foreach (Brick brick in blueBricks) brick.Draw(spriteBatch); spriteBatch.End(); blue = gBlur.PerformGaussianBlur((Texture2D) maxBlur, helperTarget, maxBlur, spriteBatch); spriteBatch.Begin(); device.SetRenderTarget(null); foreach (Brick brick in redBricks) brick.Draw(spriteBatch); foreach (Brick brick in greenBricks) brick.Draw(spriteBatch); spriteBatch.Draw(blue, new Rectangle(0, 0, blue.Width, blue.Height), Color.White); foreach (Brick brick in purpleBricks) brick.Draw(spriteBatch); spriteBatch.End(); } I'm sorry about the massive brick of text and images(or not....new user, I tried, it said no), but I wanted to get my problem across clearly as I have been searching for an answer to this for quite a while now. As a side note, I have seen the bloom sample. Very well commented, but overly complicated since it deals in 3D; I was unable to take what I needed to learn form it. Thanks for any and all help.

    Read the article

  • Ubuntu 12.10 & 12.04.1 LTS mouse freezing (Saitek Cyborg R.A.T.5 Mouse)

    - by Eric Dand
    I've figured it out: it's the Cyborg mouse. I'll be looking through the questions as I remember seeing something about this. I'm getting a similar issue to this fellow: Ubuntu 11.04 randomly freezes for over one minute Sometimes it comes back to life after a minute or two only to crash again. Alt-tab works, but it does not display the windows-switching animation. It just switches the focus... sometimes. Ctrl-Alt-T works, thankfully, and the terminal stays responsive long enough for me to get in a "sudo reboot now" and type my password. I'm running a fresh Wubi install on a separate HDD from my Windows install. 64-bit 12.10 12.04.1 LTS now, with an AMD FX chip, 8GB of RAM, and a Radeon HD 3850. My mouse is a Saitek Cyborg R.A.T.5 Mouse, and my keyboard is a stock Acer one that came with a PC I bought a few years ago.

    Read the article

  • Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML - Part Two

    - by Janice J. Heiss
    A new article by Oracle’s Java Champion Jim Weaver, titled “Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML -- Part Two,” now up on otn/java, shows developers how to leverage the power of the FX Markup Language to define the UI for enterprise applications. Weaver, the author of Pro JavaFX Platform, extends the SearchDemoFXML example used in Part One to include more concepts and techniques for creating an enterprise application using FXML. Weaver concludes the article by summarizing its content, “FXML provides the ability to radically change the UI without modifying the controller. This task can be accomplished by loading different FXML documents, leveraging JavaFX cascading style sheets, and creating localized resource bundles. Named parameters can be used with these features to provide relevant information to an application at startup.” Check out the article here.

    Read the article

  • GLSL Shader Effects: How to do motion blur, etc?

    - by DevilWithin
    I am not sure how right it is to ask this question, but still here it goes. I have a full 2D environment, with sprites going around as landscape, characters, etc And to make it more state-of-art looking, i want to implement a motion blur effect, similar to modern FPS's (i.e. crysis) blur when moving fast the camera. In a sidescroller, the desired effect is having this slight blur appearing to give the idea of fast movement, when the camera is moving. If anyone could give me some tips on doing this, im assuming in a pixel shader, i'd be grate. Also, if anyone has other good tips on cool pixel shader effects for 2D games it would be awesome, like some stylizing post fx, such as previous Prince of Persia illustrative style. Thanks

    Read the article

  • XBMC freezes pc after viewing movies

    - by Eric
    Tough to replicate, but basically after watching any movie in my library on XBMC, it'll randomly start freezing my pc. All I can do is either force shutdown by holding down the power button or wait for it to shut itself down. It's not any particular movie, it's not any particular amount of time watching one. It only happens while using XBMC. PC is older, I know the hardware is outdated, but it's not overheating nor is a simple movie too much for it to play, at least I don't think it is. Specs: Intel Core 2 6400. nVidia Quardro FX 560 4GB RAM So any suggestions? I don't have any bug/error reports because it doesn't print out any. I'm trying to find a program like XBMC, as I like having my movies organized and not have to hunt through folders to find them, so any suggestions there?

    Read the article

  • A LEGO-Themed Take On the Movie Inception [Video]

    - by Jason Fitzpatrick
    This Inception-inspired short film combines LEGO and CGI to great effect. Courtesy of a Staffordshire University design team, the short is a result of roughly a thousand hours of design work spread between seven students to serve as their semester project in visual FX. It has everything you could want from Inception rendered in LEGO: folding landscapes, flying bricks, an a LEGO man or two even loses his head. [via Geeks Are Sexy] HTG Explains: What Is Windows RT and What Does It Mean To Me? HTG Explains: How Windows 8′s Secure Boot Feature Works & What It Means for Linux Hack Your Kindle for Easy Font Customization

    Read the article

  • New to CG shader programming, what program should I use to write and test them?

    - by Notbad
    I have started witting some shaders. First ones were fairly easy to write in notepad but now I need something with a bit more meat. I have checked rendermonnkey that seems to support CG but it is really old and don't know if it is a good option. On the other hand there exist this FX Composer 2.0 but it seems somthing that could really distract me from learning shaders because it seems a pretty deep program. Are there any other possibilities? There's a really nice alternative to write shaders named ShaderToy but just supports GLSL. Any information will be really welcomed. Thanks in advance.

    Read the article

  • Oracle Developer Day, Warsaw, March 28th 2012

    - by Ruxandra Radulescu
    Java doesn't begin and end with the server – Java is everywhere. From servers and desktop applications to mobile devices, wireless sensors, smart cards, and TVs, Java is the world's most widely used software development language and platform - the choice of more than 9 million developers worldwide. Learn how Java technology can enrich your development experience at this one day event, on 28th of March 2012 in Warsaw. This event is designed for developers, project managers and architects interested in: Java EE 6 Java FX Java Web Services Oracle ADF and Weblogic Server Oracle SOA, BPM and BAM Network with peers, see cutting edge demonstrations from Oracle experts, and code your way through demo workshops. Here are some interesting hands-on sessions from the agenda: - Rapid Java EE 6 Application Development - What's New in NetBeans IDE 7.1? - Getting Started with Pluggable Desktop Development - Supercharge your productivity in Building Applications with Oracle ADF - Live Demo - Charting with ADF Data Visualization Components - Managing Auctions with Oracle SOA Suite -Live Demo  Register Now

    Read the article

  • How to get xy coordinates along a given path

    - by netbrain
    Say i have two points (x,y), (0,0) and (10,10). Now i wan´t to get coordinates along the line by stepping through values of x and y. I thought i solved it with the following functions: fy = startY + (x - startX) * ((destY-startY)/(destX-startX)); fx = (y + startY) / ((destY-startY)/(destX-startX)) + startX; taken from http://en.wikipedia.org/wiki/Linear_interpolation However, it seems that im getting a problem when destX and startX is the same value, so you get division by zero. Is there a better way of getting coordinates along a line when knowing the start and endpoint of the line?

    Read the article

  • How can i change focus when game locks it?

    - by GrizzLy
    I am playing wolfenstein:enemy territory, and if i play it in windowed mode, i can't change focus from game to something else (alt+tab doesnt work). EDIT1: As far as i could try, only ctrl+alt+Fx works (x is one number, for example F1 will switch to terminal). Could i somehow capture this kind of shortcut somewhere on X level and then send it to compiz to change focus (minimize currently focused window)? EDIT2: I found one other way, it works for Wolf:ET, it may help with other games too, if you turn on gameconsole (usually tilde key) game will release mouse lock (in windowed mode).

    Read the article

  • Delete blank row in dropdownlist or select default value in infopath dropdown

    - by KunaalKapoor
    Regular Dropdown (Pulling from DataSource)1. Double click on dropdown field in the data source.2. Select Fx button for Default value.3. Select Insert field or group.4. Select secondary xml from data source.5. Select “value” and click on ok.For a cascading dropdown:You have to add the rule and follow these steps,1. Rules -> ‘Add’ - > ‘Add Action’.2. Select ‘Set a field value’ option in first dropdown in Action.3. Select your field with help of ‘Select a Field or Group’ option in ‘Field’.4. Select your external data source list value in ‘Value’.This rule you can apply in OnLoad or whenever you will get external data source values.

    Read the article

  • No desktop after installation of nvidia drivers

    - by hovmand
    I have a problem very similar to this guy: Desktop does not show when I installed nvidia drivers!. I have the same problem with the desktop not being present when I install choose the nvidia drivers from the software sources dialog. I've trie the answer mark as the solution, but this doesn't help me. Still get the same result / bug. I've also tried just to reconfigure it, like this guy says: http://ubuntuforums.org/showpost.php?p=12303179&postcount=4, but that didn't help me either. Then someone suggested that I should try Bumblebee. I followed the installation (https://wiki.ubuntu.com/Bumblebee#Installation) and after the reboot the resolution was still crappy, but this time the desktop did show up, but with bad graphics and I couldn't use optirun and it turned out that bumblebee couldn't start. I hope someone might know whats wrong or what I'm doing wrong. I have a Lenovo W520 with a nvidia Quadro FX 880M and I'm running ubuntu 12.10

    Read the article

  • Can't start ubuntu 11.10, Stops at login screen!

    - by Martinpizza
    I have been trying to dual boot ubuntu with windows 7 via WUBI on my custom built pc but without success. When i start the computer i can choose windows or ubuntu i choose ubuntu and when i should get to the login screen the screen just stays purple/pink. Tried safe mode but cant get in there either. I have tried reinstall but did not work either. :( The second time i install ubuntu the screen was purple/pink and the screen was cut of so the left side was on the right side and right side on left side (hard to describe) Third time installing (The last time) it is just like the first time please help!!!! cant get nowhere without help i am kinda new at ubuntu and its creepy commands. Had ubuntu on my old computer. I think the problem is my hardware so here is my computer specs: Amd Fx 6100 Amd HIS Radeon HD 6950 ICEQ X Asus Sabertooth 990fx 1TB Harddrive I have no idea the name on it Please Help me!! Sorry for my bad English! :D

    Read the article

  • Attempting to install Ubuntu 11.10 along side Windows 7 Professional 64bit. Installer doesn't recognize an operating system present

    - by KichigaiDave
    System Details: Asus Sabertooth 990FX motherboard AMD FX-8120 CPU 16 GB DDR3 1600 Corsair Vengance RAM (4x4) EVGA Nvidia GTX-560Ti video card 2x Dvd/cd rw dirves 1 Bluray RW drive 1 Orico USB 3.0 & eSata panel 1 Sabrent floppy bay card reader w/USB 2.0 port 760W pc power & cooling PS OCZ agility 120GB SSD (Windows 7 Professional 64bit installed in an approx 80gb partition, NTFS. There is also a "System Reserved" partition shown in disk management at 100mb in size, also NTFS) That leaves about 32GB usable free, un-partitioned space in which I hoped to install Ubuntu. However when I run the Ubuntu 11.10 AMD64 installer, it doesn't show there is even an operating system installed. It just shows the entire drive as free-unpartitioned space. Just not sure what to do here. I was thinking about using the Wubi installer, but i don't know about that. Is the performance reduction pretty drastic? Thanks,

    Read the article

  • How do you learn to effectively use more than one framework

    - by LongTTH
    Someday, my leader told me that don't reinvent the wheels, use framework built-in classes. (with a serious mood) when I implement some algorithm has been supported by .NET fx. And seriously, I didn't know about these support before, cause this is the first time I work with .NET). So I have this questions. For example, for building an Web-App we have some ways: C# with ASP.NET framework Java with JavaEE (and friends like Struts, Spring v.v.) framework. PHP with Zend framework. ... It just takes about 1 months to learn language (C#, Java, PHP...), BUT learning to use a framework effectively takes you at least SOME YEARS working (to know every bit of code has been built-in). So, how do you learn to use effectively 2 (or more) frameworks? Any ideas are welcome!

    Read the article

  • Mac theme for Firefox

    - by Anirudha
    Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/10/19/mac-theme-for-firefox.aspxFrom a long time There is a theme for Firefox that is called MacOSX Theme This is used for make Firefox appearance like Mac. The bad news about this add-ons is that this plugin doesn’t maintain as good as it should be. Now this add-ons theme doesn’t work current Firefox. Don’t worry. You can got it f1beta.com/macosx_theme_firefox_4-1.8.1-fx.xpi  Note:-  This plugin is work of https://addons.mozilla.org/en-US/firefox/user/golf-at/ and found online https://addons.mozilla.org/en-US/firefox/addon/macosx-theme-firefox-4/?src=api I just patch it for people who have problem with installing it on latest Firefox. You can still use This theme from original site with this hack https://addons.mozilla.org/en-US/firefox/addon/checkcompatibility/ this plugin make the unsupported plugin worked.

    Read the article

  • 12.4 LTS after update fails to login

    - by user111839
    An update today (30-11-2012) on 12.4 lead to failure to log in. The system gets through its boot process then presents the logins, on choosing any of these immediately returned to log-in screen with no error. Machine is an AMD FX 64 on an Asus MB using the built-in graphics. If no one knows what this might be, what's the alternative distro to Ubuntu? It's the second time something like this has happened after an update in three months, kudos to the Ubuntu team but I need more reliability. Cheers, thanks to all.

    Read the article

  • NetBeans 7.1 Release Candidate (RC) 1 is here

    - by alexismp
    NetBeans 7.1 RC 1 is here. Grab it from the usual place! As previously discussed, NetBeans 7.1 has full JavaFX 2.0 support but also a lot in store for Java EE and Web developers (CDI in particular is very neat). One of my personal favorite feature is that Deploy on Save is now set by default on Maven projects. Maybe one important part that didn't get proper coverage so far is CSS 3 support, an important feature which can be used from both Java EE and PHP but also from JavaFX. Java Downloads of NetBeans 7.1 start at 69 MB and a 166 MB download will get you everything you need to start coding right away with Java EE - a great tool and a fully integrated runtime (GlassFish 3.1.1). You really need to be not using Maven, not be interested in recent standards (Java EE 6, Java SE 7, Java FX 2.0, ...) and like to hand-craft assemble your IDE to afford ignoring NetBeans nowadays.

    Read the article

  • 7?????JavaOne Tokyo 2012???????????!

    - by hideki ito
    2012?4?4???????????????49???JavaOne Tokyo 2012???????????7???4????????????4??5??2??????????????????? ???????????JavaOne Tokyo 2012??????????????! ??????Java Strategy Keynote???????????????????Java????????????????Java?????????????????????????Java???????????4????????????Java?????????????????????????????????????7?????????????????????????????????????? ????·?????????????????·??????????Henrik Stahl?JDK??????????????2012?4??JDK7??4????????????????2013??JDK8????????????? ????????????·?????·??????????Rob Benson?????·???????????Twitter?Java????????????????? ????·???????? Java??????????????·???????Nandini Ramani?????Java??????????????Java FX??????????????? ????·???????? ????????·???????Cameron Purdy???????????????????????Java EE 7?????????????????????????? ?????????????????????????????????????Core Java??Client Java??Enterprise Java??Embedded Jave??4??????????????????????????????????????????????????????? ??????????????????????! ???????????????????????????????? ??????????????????????????????????????????????????? ?????????JavaOne Tokyo 2012???2???????????????????????????????????????! ???????Java ???????Duke????????????????!

    Read the article

  • ????JavaFX??Java???????·?????????????????Java Developer Workshop #2?????|WebLogic Channel|??????

    - by ???02
    WebLogic Server?????????Java???????????????????WebLogic Channel?????????JavaOne 2011??Java/Java EE????????!――???????????????!!?????????????????????JavaOne 2011????????????????????????????????????JavaFX?????2011?12?1?????????????Java?????????????Java Developer Workshop #2????JavaOne 2011?JavaFX???????????????Oracle Corporation?JavaFX??????Nandini Ramani?(Client Java Group???????????)??????JavaFX 2.0-Next generation Java client solution????????????????????JavaFX?????????????????????(???)?Pure Java???????UI??????JavaFX 2.0??JavaOne 2011??Java/Java EE????????!???????????API????Java????????????1?????????Ramani?????????JavaFX????????JavaFX 2.0?????????????????????? ???JavaFX 2.0?????????????????????????????????JavaFX Script??????????????????Java?????????????·???????????????????????Java????????????????????????????? ??????????????PC????????????·??????????????????????????????????????API???????????????????·?????????????????????????????????????????????900????????????Java???????????JavaFX??????????????????????????????·???????(UI)????????????????????(Ramani?) Ramani??????JavaFX 2.0??????/???????????100% Java API?Swing????FXML???UI????????WebKit???Web???????????????????????????? ??????FXML(FX Markup Language)???JavaFX?UI????????XML????????????????Ramani????????????????????????????????·?????????????UI????????????????????????JavaScript?Groovy?Scala???JVM???????????????????????? ???JavaFX 2.0????????(JavaFX Runtime)???????????????????????AWT????????????????OS???????????????Glass Windowing Toolkit??2D/3D????????·???????GPU???????????Prism???????????????? ?????Prism????????????????·??????????3D?????????????????????????????????????????????·????????60fps??HD??????????VP6?MP3?????????????????????????????????????·?????????????? ?????????????????????????JavaFX 2.0???????Ramani???????????????????·????????????·???????????????????????????????JavaFX 2.0?????????????·?????????????????????????????????????Prism???????????????????????????????????????????????????????????????????????JavaFX??????????·??????????????????????????????????????????????/???????????(?????????)???????????????????? ??????????????????NetBeans IDE 7.0?????Eclipse?JDeveloper???????IDE?????????????????????????????&??????????????UI???????JavaFX Scene Builder???????? ?????JavaFX 2.0???????????·???????????????3D????????????·????????????????????????????????????Ramani????JavaFX Labs????????????JavaFX 2.0????????????????????????????3D???????????????????????????????UI?????????????????????????????????????3D???·????????????????? ???JavaFX 2.0?????????????3D?????????·??????·??????????????????????·?????·?????Kinect?????????????????????·?????????????????????·?????·????Kinect????3D?????????????????????????????? ????JavaFX????????????????????????JavaFX????????·?????????Linux?????????PC?iPad???????????????????? ?????????2???????????JavaFX??Java??????????????????GUI?????????????????????????????JavaFX??????????????????????Ramani??????????? ?JavaFX???????????????????????????????·??????????????????Swing?AWT???????????????·????????????????????????????????????? ???JavaFX???????????·???????OpenJFX?????OpenJDK????????????????????????????UI??????????????????Ramani??????????????????????????????????????????????Java???????????????????JavaFX???????????????????????????????????????????:?Java Developer Workshop #2?????Nandini Ramani?????????????????????

    Read the article

  • YouTube API Security Error Flex

    - by 23tux
    Hi, I've tried to use the YoutTube API within a Flex project. But i got this error: *** Security Sandbox Violation *** SecurityDomain 'http://www.youtube.com/apiplayer?version=3' tried to access incompatible context 'file:///Users/YouTubePlayer/bin-debug/YouTubePlayer.html' Here are the two files: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768" xmlns:youtube="youtube.*" creationComplete="init();"> <fx:Script> <![CDATA[ [Bindable] private var ready:Boolean = true; private function init():void { Security.allowInsecureDomain("*"); Security.allowDomain("*"); Security.allowDomain('www.youtube.com'); Security.allowDomain('youtube.com'); Security.allowDomain('s.ytimg.com'); Security.allowDomain('i.ytimg.com'); } private function changing():void { /* trace("currentTime: " + player.getCurrentTime()); trace("startTime: " + player.startTime); trace("stopTime: " + player.stopTime); timeSlider.value = player.getCurrentTime() */ } private function startPlaying():void { player.play(); } private function checkStartSlider():void { if(startSlider.value > stopSlider.value) stopSlider.value = startSlider.value + 1; } private function checkStopSlider():void { if(stopSlider.value < startSlider.value) startSlider.value = stopSlider.value - 1; } ]]> </fx:Script> <s:VGroup> <youtube:Player id="player" videoID="DVFvcVuWyfE" change="changing();" ready="ready=true"/> <s:HGroup> <s:Button label="play" click="startPlaying();" /> </s:HGroup> <s:HGroup> <s:HSlider id="timeSlider" width="250" minimum="0" maximum="{player.stopTime}" snapInterval=".01" enabled="{ready}"/> <s:Label id="currentTimeLbl" text="current time: 0" /> </s:HGroup> <s:HGroup> <s:HSlider id="startSlider" width="250" minimum="0" maximum="{player.stopTime}" snapInterval=".01" change="checkStartSlider();" enabled="{ready}" value="0"/> <s:Label id="startTimeLbl" text="start time: {player.startTime}" /> </s:HGroup> <s:HGroup> <s:HSlider id="stopSlider" width="250" minimum="0" maximum="{player.stopTime}" snapInterval=".01" change="checkStopSlider();" enabled="{ready}" value="{player.stopTime}"/> <s:Label id="stopTimeLbl" text="stop time: {player.stopTime}" /> </s:HGroup> </s:VGroup> </s:Application> Here is the player package youtube { import flash.display.Loader; import flash.events.Event; import flash.events.TimerEvent; import flash.net.URLRequest; import flash.system.Security; import flash.utils.Timer; import mx.core.UIComponent; [Event(name="change", type="flash.events.Event")] [Event(name="ready", type="flash.events.Event")] public class Player extends UIComponent { private var player:Object; private var loader:Loader; private var _startTime:Number = 0; private var _stopTime:Number = 0; private var _videoID:String; private var metadataTimer:Timer = new Timer(200); private var playTimer:Timer = new Timer(200); public function Player() { // The player SWF file on www.youtube.com needs to communicate with your host // SWF file. Your code must call Security.allowDomain() to allow this // communication. Security.allowInsecureDomain("*"); Security.allowDomain("*"); // This will hold the API player instance once it is initialized. loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3")); } private function onLoaderInit(event:Event):void { addChild(loader); loader.content.addEventListener("onReady", onPlayerReady); loader.content.addEventListener("onError", onPlayerError); loader.content.addEventListener("onStateChange", onPlayerStateChange); loader.content.addEventListener("onPlaybackQualityChange", onVideoPlaybackQualityChange); } private function onPlayerReady(event:Event):void { // Event.data contains the event parameter, which is the Player API ID trace("player ready:", Object(event).data); // Once this event has been dispatched by the player, we can use // cueVideoById, loadVideoById, cueVideoByUrl and loadVideoByUrl // to load a particular YouTube video. player = loader.content; // Set appropriate player dimensions for your application player.setSize(0, 0); } private function onPlayerError(event:Event):void { // Event.data contains the event parameter, which is the error code trace("player error:", Object(event).data); } private function onPlayerStateChange(event:Event):void { // Event.data contains the event parameter, which is the new player state trace("player state:", Object(event).data); } private function onVideoPlaybackQualityChange(event:Event):void { // Event.data contains the event parameter, which is the new video quality trace("video quality:", Object(event).data); } [Bindable] public function get videoID():String { return _videoID; } public function set videoID(value:String):void { _videoID = value; } [Bindable] public function get stopTime():Number { return _stopTime; } public function set stopTime(value:Number):void { _stopTime = value; } [Bindable] public function get startTime():Number { return _startTime; } public function set startTime(value:Number):void { _startTime = value; } public function play():void { if(_videoID!="") { player.loadVideoById(_videoID, 0); // add the event listener, so that all 200 milliseconds is an event dispatched metadataTimer.addEventListener(TimerEvent.TIMER, metadataTimeHandler); // if the timer is running, stop and reset it if(metadataTimer.running) metadataTimer.reset(); else metadataTimer.start(); } } private function metadataTimeHandler(e:TimerEvent):void { if(player.getDuration() > 0) { startTime = 0; stopTime = player.getDuration(); metadataTimer.reset(); metadataTimer.stop(); metadataTimer.removeEventListener(TimerEvent.TIMER, metadataTimeHandler); player.playVideo(); playTimer.addEventListener(TimerEvent.TIMER, playTimerHandler); dispatchEvent(new Event("ready")); } } private function playTimerHandler(e:TimerEvent):void { if(getCurrentTime() > _stopTime) { seekTo(startTime); } dispatchEvent(new Event(Event.CHANGE)); } public function getCurrentTime():Number { if(!player.getCurrentTime()) return 0; else return player.getCurrentTime(); } public function seekTo(time:uint):void { player.seekTo(time); } } } Hope someone can help. thx, tux

    Read the article

  • Issues passing values to shader

    - by numerical25
    I am having issues passing values to my shader. My application compiles fine, but my cube object won't shade. Below is majority of my code. Most of my code for communicating with my shader is in createObject method myGame.cpp #include "MyGame.h" #include "OneColorCube.h" /* This code sets a projection and shows a turning cube. What has been added is the project, rotation and a rasterizer to change the rasterization of the cube. The issue that was going on was something with the effect file which was causing the vertices not to be rendered correctly.*/ typedef struct { ID3D10Effect* pEffect; ID3D10EffectTechnique* pTechnique; //vertex information ID3D10Buffer* pVertexBuffer; ID3D10Buffer* pIndicesBuffer; ID3D10InputLayout* pVertexLayout; UINT numVertices; UINT numIndices; }ModelObject; ModelObject modelObject; // World Matrix D3DXMATRIX WorldMatrix; // View Matrix D3DXMATRIX ViewMatrix; // Projection Matrix D3DXMATRIX ProjectionMatrix; ID3D10EffectMatrixVariable* pProjectionMatrixVariable = NULL; ID3D10EffectVectorVariable* pLightVarible = NULL; bool MyGame::InitDirect3D() { if(!DX3dApp::InitDirect3D()) { return false; } D3D10_RASTERIZER_DESC rastDesc; rastDesc.FillMode = D3D10_FILL_WIREFRAME; rastDesc.CullMode = D3D10_CULL_FRONT; rastDesc.FrontCounterClockwise = true; rastDesc.DepthBias = false; rastDesc.DepthBiasClamp = 0; rastDesc.SlopeScaledDepthBias = 0; rastDesc.DepthClipEnable = false; rastDesc.ScissorEnable = false; rastDesc.MultisampleEnable = false; rastDesc.AntialiasedLineEnable = false; ID3D10RasterizerState *g_pRasterizerState; mpD3DDevice->CreateRasterizerState(&rastDesc, &g_pRasterizerState); //mpD3DDevice->RSSetState(g_pRasterizerState); // Set up the World Matrix D3DXMatrixIdentity(&WorldMatrix); D3DXMatrixLookAtLH(&ViewMatrix, new D3DXVECTOR3(0.0f, 10.0f, -20.0f), new D3DXVECTOR3(0.0f, 0.0f, 0.0f), new D3DXVECTOR3(0.0f, 1.0f, 0.0f)); // Set up the projection matrix D3DXMatrixPerspectiveFovLH(&ProjectionMatrix, (float)D3DX_PI * 0.5f, (float)mWidth/(float)mHeight, 0.1f, 100.0f); if(!CreateObject()) { return false; } return true; } //These are actions that take place after the clearing of the buffer and before the present void MyGame::GameDraw() { static float rotationAngleY = 15.0f; static float rotationAngleX = 0.0f; static D3DXMATRIX rotationXMatrix; static D3DXMATRIX rotationYMatrix; // create the rotation matrix using the rotation angle D3DXMatrixRotationY(&rotationYMatrix, rotationAngleY); D3DXMatrixRotationX(&rotationXMatrix, rotationAngleX); //rotationAngleY += (float)D3DX_PI * 0.002f; //rotationAngleX += (float)D3DX_PI * 0.001f; WorldMatrix = rotationYMatrix * rotationXMatrix; // Set the input layout mpD3DDevice->IASetInputLayout(modelObject.pVertexLayout); // Set vertex buffer UINT stride = sizeof(VertexPos); UINT offset = 0; mpD3DDevice->IASetVertexBuffers(0, 1, &modelObject.pVertexBuffer, &stride, &offset); // Set primitive topology mpD3DDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); //ViewMatrix._43 += 0.005f; // Combine and send the final matrix to the shader D3DXMATRIX finalMatrix = (WorldMatrix * ViewMatrix * ProjectionMatrix); pProjectionMatrixVariable->SetMatrix((float*)&finalMatrix); // make sure modelObject is valid // Render a model object D3D10_TECHNIQUE_DESC techniqueDescription; modelObject.pTechnique->GetDesc(&techniqueDescription); // Loop through the technique passes for(UINT p=0; p < techniqueDescription.Passes; ++p) { modelObject.pTechnique->GetPassByIndex(p)->Apply(0); // draw the cube using all 36 vertices and 12 triangles mpD3DDevice->Draw(36,0); } } //Render actually incapsulates Gamedraw, so you can call data before you actually clear the buffer or after you //present data void MyGame::Render() { DX3dApp::Render(); } bool MyGame::CreateObject() { //Create Layout D3D10_INPUT_ELEMENT_DESC layout[] = { {"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT, 0 , 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"COLOR",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"NORMAL",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 24, D3D10_INPUT_PER_VERTEX_DATA, 0} }; UINT numElements = (sizeof(layout)/sizeof(layout[0])); modelObject.numVertices = sizeof(vertices)/sizeof(VertexPos); for(int i = 0; i < modelObject.numVertices; i += 3) { D3DXVECTOR3 out; D3DXVECTOR3 v1 = vertices[0 + i].pos; D3DXVECTOR3 v2 = vertices[1 + i].pos; D3DXVECTOR3 v3 = vertices[2 + i].pos; D3DXVECTOR3 u = v2 - v1; D3DXVECTOR3 v = v3 - v1; D3DXVec3Cross(&out, &u, &v); D3DXVec3Normalize(&out, &out); vertices[0 + i].normal = out; vertices[1 + i].normal = out; vertices[2 + i].normal = out; } //Create buffer desc D3D10_BUFFER_DESC bufferDesc; bufferDesc.Usage = D3D10_USAGE_DEFAULT; bufferDesc.ByteWidth = sizeof(VertexPos) * modelObject.numVertices; bufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER; bufferDesc.CPUAccessFlags = 0; bufferDesc.MiscFlags = 0; D3D10_SUBRESOURCE_DATA initData; initData.pSysMem = vertices; //Create the buffer HRESULT hr = mpD3DDevice->CreateBuffer(&bufferDesc, &initData, &modelObject.pVertexBuffer); if(FAILED(hr)) return false; /* //Create indices DWORD indices[] = { 0,1,3, 1,2,3 }; ModelObject.numIndices = sizeof(indices)/sizeof(DWORD); bufferDesc.ByteWidth = sizeof(DWORD) * ModelObject.numIndices; bufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER; initData.pSysMem = indices; hr = mpD3DDevice->CreateBuffer(&bufferDesc, &initData, &ModelObject.pIndicesBuffer); if(FAILED(hr)) return false;*/ ///////////////////////////////////////////////////////////////////////////// //Set up fx files LPCWSTR effectFilename = L"effect.fx"; modelObject.pEffect = NULL; hr = D3DX10CreateEffectFromFile(effectFilename, NULL, NULL, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, mpD3DDevice, NULL, NULL, &modelObject.pEffect, NULL, NULL); if(FAILED(hr)) return false; pProjectionMatrixVariable = modelObject.pEffect->GetVariableByName("Projection")->AsMatrix(); pLightVarible = modelObject.pEffect->GetVariableByName("lightSource")->AsVector(); //Dont sweat the technique. Get it! LPCSTR effectTechniqueName = "Render"; D3DXVECTOR3 vLight(10.0f, 10.0f, 10.0f); pLightVarible->SetFloatVector(vLight); modelObject.pTechnique = modelObject.pEffect->GetTechniqueByName(effectTechniqueName); if(modelObject.pTechnique == NULL) return false; //Create Vertex layout D3D10_PASS_DESC passDesc; modelObject.pTechnique->GetPassByIndex(0)->GetDesc(&passDesc); hr = mpD3DDevice->CreateInputLayout(layout, numElements, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &modelObject.pVertexLayout); if(FAILED(hr)) return false; return true; } And below is my shader effect.fx matrix Projection; float3 lightSource; float4 lightColor = {0.5, 0.5, 0.5, 0.5}; // PS_INPUT - input variables to the pixel shader // This struct is created and fill in by the // vertex shader struct PS_INPUT { float4 Pos : SV_POSITION; float4 Color : COLOR0; float4 Normal : NORMAL; }; //////////////////////////////////////////////// // Vertex Shader - Main Function /////////////////////////////////////////////// PS_INPUT VS(float4 Pos : POSITION, float4 Color : COLOR, float4 Normal : NORMAL) { PS_INPUT psInput; // Pass through both the position and the color psInput.Pos = mul( Pos, Projection ); psInput.Color = Color; psInput.Normal = Normal; return psInput; } /////////////////////////////////////////////// // Pixel Shader /////////////////////////////////////////////// float4 PS(PS_INPUT psInput) : SV_Target { float4 finalColor = 0; finalColor = saturate(dot(lightSource, psInput.Normal) * lightColor); return finalColor; } // Define the technique technique10 Render { pass P0 { SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, PS() ) ); } }

    Read the article

  • MooTools Tween in percent

    - by FatalRabbit
    Is it possible to tween an element in percent in MooTools? var slide = new Fx.Tween($('slide_box')); $('next_slide').addEvent('click',function(){ slide.start('left', '-100%'); }); But this code tween an element by 100px, not in percent.

    Read the article

  • Issues with Flex 4 SDK under Flex Builder 3

    - by user252160
    I have managed to adjust Flex Builder 3 to work with the Flex 4 SDK thanks to this article. However, some strange things are happening. I changed all the namespaces as suggested, but I cannot get anything from the fx: namespace using the Flex Builder code completion, as well as the spark List class.

    Read the article

  • Jquery Tabs help with onShow function

    - by StealthRT
    Hey all i am trying to figiure out why my code is not triggering the "onShow" function for the tabs. Here is my code: $(document).ready(function() { $('#tabMain > ul').tabs({ fx: {height: 'toggle'},onShow: function() {alert('onShow');} }); }) I never see the alert box pop up saying "onShow" so i do not know what i am doing wrong? Any help would be awesome! :) David

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >