Search Results

Search found 2390 results on 96 pages for 'morten green hermansen'.

Page 60/96 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • OpenGL render vs. own Phong Illumination Implementation

    - by Myx
    Hello: I have implemented a Phong Illumination Scheme using a camera that's centered at (0,0,0) and looking directly at the sphere primitive. The following are the relevant contents of the scene file that is used to view the scene using OpenGL as well as to render the scene using my own implementation: ambient 0 1 0 dir_light 1 1 1 -3 -4 -5 # A red sphere with 0.5 green ambiance, centered at (0,0,0) with radius 1 material 0 0.5 0 1 0 0 1 0 0 0 0 0 0 0 0 10 1 0 sphere 0 0 0 0 1 The resulting image produced by OpenGL. The image that my rendering application produces. As you can see, there are various differences between the two: The specular highlight on my image is smaller than the one in OpenGL. The diffuse surface seems to not diffuse in the correct way, resulting in the yellow region to be unneccessarily large in my image, whereas in OpenGL there's a nice dark green region closer to the bottom of the sphere The color produced by OpenGL is much darker than the one in my image. Those are the most prominent three differences that I see. The following is my implementation of the Phong illumination: R3Rgb Phong(R3Scene *scene, R3Ray *ray, R3Intersection *intersection) { R3Rgb radiance; if(intersection->hit == 0) { radiance = scene->background; return radiance; } R3Vector normal = intersection->normal; R3Rgb Kd = intersection->node->material->kd; R3Rgb Ks = intersection->node->material->ks; // obtain ambient term R3Rgb intensity_ambient = intersection->node->material->ka*scene->ambient; // obtain emissive term R3Rgb intensity_emission = intersection->node->material->emission; // for each light in the scene, obtain calculate the diffuse and specular terms R3Rgb intensity_diffuse(0,0,0,1); R3Rgb intensity_specular(0,0,0,1); for(unsigned int i = 0; i < scene->lights.size(); i++) { R3Light *light = scene->Light(i); R3Rgb light_color = LightIntensity(scene->Light(i), intersection->position); R3Vector light_vector = -LightDirection(scene->Light(i), intersection->position); // calculate diffuse reflection intensity_diffuse += Kd*normal.Dot(light_vector)*light_color; // calculate specular reflection R3Vector reflection_vector = 2.*normal.Dot(light_vector)*normal-light_vector; reflection_vector.Normalize(); R3Vector viewing_vector = ray->Start() - intersection->position; viewing_vector.Normalize(); double n = intersection->node->material->shininess; intensity_specular += Ks*pow(max(0.,viewing_vector.Dot(reflection_vector)),n)*light_color; } radiance = intensity_emission+intensity_ambient+intensity_diffuse+intensity_specular; return radiance; } Here are the related LightIntensity(...) and LightDirection(...) functions: R3Vector LightDirection(R3Light *light, R3Point position) { R3Vector light_direction; switch(light->type) { case R3_DIRECTIONAL_LIGHT: light_direction = light->direction; break; case R3_POINT_LIGHT: light_direction = position-light->position; break; case R3_SPOT_LIGHT: light_direction = position-light->position; break; } light_direction.Normalize(); return light_direction; } R3Rgb LightIntensity(R3Light *light, R3Point position) { R3Rgb light_intensity; double distance; double denominator; if(light->type != R3_DIRECTIONAL_LIGHT) { distance = (position-light->position).Length(); denominator = light->constant_attenuation + light->linear_attenuation*distance + light->quadratic_attenuation*distance*distance; } switch(light->type) { case R3_DIRECTIONAL_LIGHT: light_intensity = light->color; break; case R3_POINT_LIGHT: light_intensity = light->color/denominator; break; case R3_SPOT_LIGHT: R3Vector from_light_to_point = position - light->position; light_intensity = light->color*( pow(light->direction.Dot(from_light_to_point), light->angle_attenuation)); break; } return light_intensity; } I would greatly appreciate any suggestions as to any implementation errors that are apparent. I am wondering if the differences could be occurring simply because of the gamma values used for display by OpenGL and the default gamma value for my display. I also know that OpenGL (or at least tha parts that I was provided) can't cast shadows on objects. Not that this is relevant for the point in question, but it just leads me to wonder if it's simply display and capability differences between OpenGL and what I am trying to do. Thank you for your help.

    Read the article

  • Test whether image loaded correctly with JavaScript

    - by johkar
    I have an image deployed on several application servers (green up arrow: uparrow.gif). I have an application server status page where I list out all the servers and with a corresponding image where the image's source is the uparrow.gif for that server. If the image does not load (server down) I would like to switch to a red down arrow (downarrow.gif). Is there a way to check whether an image loaded or not with straight JavaScript (no JS libraries etc)? I would imagine I would set an interval for it to continue checking if the user were on the page. Thanks.

    Read the article

  • Any best practices with feedback colours?

    - by alex
    I have a few that I think are correct. These are background colours for messages. ERROR: red; INFO: blue; SUCCESS: green; NOT IMPORTANT INFO: yellow Have I got the blue and yellow around the wrong way? Any hex values that are a de facto standard for these? I am curious considering web development, but I think the answers will be agnostic. Here is an interesting thought (I'm sure I've read about it in an article). What colours would the errors be on Target's website, considering all their branding is red?

    Read the article

  • Safe deployment of ASP.Net applications

    - by gatapia
    Hi All, I have an asp.net app that I want to deploy safely (with as little down time possible). I would love to do something like blue green deployment but without the need for a second web server. So, I know I can use load balancing, etc but I need a quick and cheap approach. I was thinking of doing something like: Setting up another website (copy of original) in IIS, currently I use host headers to direct traffic across sites). I could then view the new site locally until the site is totally online (due to NHibernate start up and various other high intensity tasks this takes a while). Once site 2 is totally started I would then change host headers around giving me a much much smaller down time. So my question is. Has anyone done anything like this? Will IIS restart my app pool or application when changing host headers (making this useless)? Any other options? Thanks for your help all. Guido

    Read the article

  • What web based programming environments exist to learn on?

    - by jjclarkson
    I loved appjet (the programming environment) before it was taken over by Google. What other web based complete programming environments are out there? Which one do you think is best for starting to do real world coding the fastest? I really think coding from your browser will make programming more accessible to the public. Are there any out there that use a vim style, (e.g. jsvi) in combination with free server side hosting? The last time I looked at Bespin it was a little green. Are there others?

    Read the article

  • Dual slider control with custom skin

    - by Ryan French
    Hi All, I'm currently trying to create a page for users to select two points from a range, using a slide control. The first point in the range is when an alert will be sent to the user, the second point is a max limit. What I would like to do is have the bar colored green from the 0 point to the first slider point, then orange between the two sliders, and lastly red from the second slider up to the other end of the bar. Does anyone know of an easy was I can do this or of a slider control that can be skinned to do this?

    Read the article

  • Removing all Matching Classes in jQuery

    - by Seth Duncan
    Hi I have an li element that will have something along the lines of this for a declaration <li class="module ui-helper-fix"> And I can dynamically change the color of the module by adding on classes (That are provided dynamically through DB calls) the end result being <li class="module ui-helper-fix module-green"> or <li class="module ui-helper-fix module-default"> Well I am fine with changing the color by adding on a new module-WHATEVER class but what I would like to do is remove any class that matches module-XXXX so it starts with a clean slate and then add on the class module-crimson. So how do I remove all classes that match module-xxx first ? Keeping in mind I don't want to remove the base module class. Thanks. -Seth

    Read the article

  • Objective-C : enum like Java (int values and many others for each enum)

    - by Oliver
    In Java, you can make an enum having multiples values. In objective-C, this cannot be done easily. I've read many pages about this but I didn't found anything satisfying that would allow me to use enums by a simple way and to keep the enum declaration and their different values in the same file. I would like to write something like this in a enums.h : // ======================================== typedef enum {eRED, eGREEN, eBLUE} ColorEnum; int colorValues[] = { 0xFF0000, 0x00FF00, 0x0000FF }; NSArray *colorNames = [NSArray arrayWithObjects:@"Red color", @"light green", @"Deep blue", nil]; // ======================================== and be able to use thoses global variables to manage my stuff anywhere like : int color = colorValues[eRED]; But I don't know how to write this. I have compile errors like "ColorValues" is defines many times. Or if I just use "static", I have many "ColorValues" not used in .m file... Could you help me ?

    Read the article

  • Regex: Strip HTML attributes except SRC

    - by Ian Silber
    Hi, I'm trying to write a regular expression that will strip all tag attributes except for the SRC attribute. For example: <p id="paragraph" class="green">This is a paragraph with an image <img src="/path/to/image.jpg" width="50" height="75"/></p> Would be returned as: <p>This is a paragraph with an image <img src="/path/to/image.jpg" /></p> I have a regular expression to strip all attributes, but I'm trying to tweak it to leave in src. Here's what I have so far: <?php preg_replace('/<([A-Z][A-Z0-9]*)(\b[^>]*)>/i', '<$1>', '<html><goes><here>'); Using PHP's preg_replace() for this. Thanks! Ian

    Read the article

  • CSS border and the :hover dynamic pseudo-class

    - by dbasch
    Hi All, I have built a persistent dropline menu with two levels using only CSS. It is pretty standard. It is a nested set of UL's and the UL's :hover state is what shows and hides the sub menu levels. Something like this: | *Pets* | Colors | Cars | | Cats | Dogs | Birds| Goats | Sheep | | Pets | *Colors* | Cars | | Red | Orange | Green | Blue| Yellow | I then added a 1px border at the bottom of the first level UL element. Like this: | *Pets* | Colors | Cars | -------------------------------------- | Cats | Dogs | Birds| Goats | Sheep | When I hover over a first level item (Pets), and then move the mouse down to the second level (Cats), the entire second level disappears. I finally figured out that the UL's 1px border is not included in the hover area for the UL. Can I add a border to the bottom of a dropline menu level without messing up the menu hovering? Thanks!

    Read the article

  • iPhone switch statement using enum

    - by Boris
    I have defined an enum in a header file of a class : typedef enum{ RED = 0, BLUE, Green } Colors; - (void) switchTest:(Colors)testColor; and in the implementation file I have : - (void) switchTest:(Colors)testColor{ if(testColor == RED){ NSLog(@"Red selected"); } switch(testColor){ case RED: NSLog(@"Red selected again !"); break; default: NSLog(@"default selected"); break; } } My code compiles correctly without warrnings. When calling the switchTest method with RED, the output is : "Red selected" but once the first line of the switch runs, the application quits unexpectedly and without warrnings/errors. I don't mind using if/else syntax but I would like to understand my mistake.

    Read the article

  • How do you fix the Silverlight application shift that occurs in the Firefox browser?

    - by Roy
    Hi, Currently I have an Silverlight application that when run on Firefox browser (ver 3.6) the entire contents of the Silverlight application shifts a little, and also the scrollbars on both the bottom and the side appear when I first use it. This does not happen in IE 8. How can I fix this in Firefox so it doesn't happen? The project type I created was the "Silverlight 3 Application + Website" via Expression Blend 3. This the code I am using in my MainPage.xaml: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="StackoverflowExample.MainPage" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="Green"> <Rectangle Fill="#FFBB2020" Stroke="Black" Margin="155,58,266,178"/> <Button Margin="199,180,302,236" Content="Button"/> </Grid> </UserControl>

    Read the article

  • Eidetic memory: What magic numbers you still remember?

    - by Hao
    Long before you practice writing readable code, what "magic numbers" you still remember up to this day? here's some of my list: 72 80 75 77 13 32 27 - up down left right enter space escape 1 2 4 128 - blue green red blink 67h 33h 17h - interrupt for EMS, mouse, printer function AH 9, interrupt 21 alt+219 for block ASCII alt+164 ñ 90 NOP 13 10 carriage return, line feed ascii 1 and 2 face, ascii 3 heart. no not this heart: <3 :-) debug -o72,10 -o71,12 clears the BIOS password. I don't know what those numbers mean, it's like a trade secret that gets shared with each other during college days. ascii 7 sounds a beep P.S. Somehow, remembering some of these magic numbers can help you in some tech problems, your keyboard is broken, the office pal's keyboard doesn't have accented characters. An anecdote, during college, one of my friend asked me how to remove the newlines in his Word document. Not having used Word so much then, I somehow "intuitively" guessed to find ^013 and replace it with blank. Well it works :-)

    Read the article

  • How to change *.ico for button in running mode?

    - by karikari
    I am currently doing visual c++ for an Internet Explorer toolbar button. I have a registration script file (*.rgs) that defines or maybe register the features of my button inside the Windows registry. My objective is, I want my button to change its *.ico image, based on certain conditions process from my *.cpp file. My problem is, I don't understand, how can I somehow change the *.ico file for my button in real time, during my application is running? For example, IF f = 1, ico_file = green.ico; ELSE ico_file = red.ico; Any idea, that you guys can point to me, how can I change the *.ico file for my Internet Explorer toolbar button while the IE is running.

    Read the article

  • Double associative array or indexed + associative array

    - by clover
    I'm undecided what's the best-practice approach for what I'm trying to do. I'm trying to enter data into an array where the data will look like this: apple color: red price: 2 orange color: orange price: 3 banana color: yellow price: 2 pineapple color: yellow price: 5 When I get input, let's say green apple (notice it's a combo of color + name of fruit), I'm going to check if the name of fruit part exists in the array and display its data (if it exists). What's the right way to compose those arrays? How would I do an indexed array containing an associative array? (or would this be better as 2 nested associative arrays, I'm guessing not)

    Read the article

  • How does Bitmap.Save(Stream, ImageFormat) format the data?

    - by Matt Jacobsen
    I have a non transparent, colour bitmap with length 2480 and width 3507. Using Bitmap.GetPixel(int x, int y) I am able to get the colour information of each pixel in the bitmap. If I squirt the bitmap into a byte[]: MemoryStream ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Bmp); ms.Position = 0; byte[] bytes = ms.ToArray(); then I'd expect to have the same information, i.e. I can go to bytes[1000] and read the colour information for that pixel. It turns out that my array of bytes is larger than I anticipated. I thought I'd get an array with 2480 x 3507 = 8697360 elements. Instead I get an array with 8698438 elements - some sort of header I presume. In what format the bytes in my array stored? Is there a header 1078 bytes long followed by Alpha, Red, Green, Blue values for every byte element, or something else?

    Read the article

  • DataBinding to GridView

    - by liran
    Hello, I Have a gridview object and i want to bind it to Object.. My Object is namespace DataBinding { public class BindingObject { public ColorInfo Color { get; set; } public string Name { get; set; } public struct ColorInfo { public string Red { get; set; } public string Green { get; set; } public string Blue { get; set; } } } } I want that in the gridview i will see only the Name Property And Red property.. Now when i bound it my gridview see like this: Color column and Name Column and i want Red column and Name Column.. How i do this.. Thanks..

    Read the article

  • Rails route, show all elements on the same page

    - by Igor Oliveira Antonio
    I need to show all my elements on the same page. In routes: namespace :nourishment do resources :diets do resources :nourishment_meals, :controller => 'meals' get 'nourishment_meals/show_all_meals' => 'meals#show_all_meals', as: "show_all_meals" end end which will generate: nourishment_diet_nourishment_meals_path GET /nourishment/diets/:diet_id/nourishment_meals(.:format) nourishment/meals#index POST /nourishment/diets/:diet_id/nourishment_meals(.:format) nourishment/meals#create new_nourishment_diet_nourishment_meal_path GET /nourishment/diets/:diet_id/nourishment_meals/new(.:format) nourishment/meals#new edit_nourishment_diet_nourishment_meal_path GET /nourishment/diets/:diet_id/nourishment_meals/:id/edit(.:format) nourishment/meals#edit nourishment_diet_nourishment_meal_path GET /nourishment/diets/:diet_id/nourishment_meals/:id(.:format) nourishment/meals#show PATCH /nourishment/diets/:diet_id/nourishment_meals/:id(.:format) nourishment/meals#update PUT /nourishment/diets/:diet_id/nourishment_meals/:id(.:format) nourishment/meals#update DELETE /nourishment/diets/:diet_id/nourishment_meals/:id(.:format) nourishment/meals#destroy [**THIS**] nourishment_diet_show_all_meals_path GET /nourishment/diets/:diet_id/nourishment_meals/show_all_meals(.:format) nourishment/meals#show_all_meals The problem, when I do this: <%= link_to "Show all meals", nourishment_diet_show_all_meals_path, :class=>"button green" %> This error raise: Problem: Document(s) not found for class NourishmentMeal with id(s) show_all. Summary: When calling NourishmentMeal.find with an id or array of ids, each parameter must match a document Can someone help me?

    Read the article

  • poblems with jquery code

    - by Michael
    Another jquery issue... I have tried this several times using "class" and "id" elements and I can not get it right. I am hoping the brains on stackoverflow can help! The problem that I am having is when I open the page all elments are closed. When I click on one link all links open. I believe it closes correctly the problem is that when I open the first link all items open. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Bid Items</title> <link href="bid.css" rel="stylesheet" type="text/css" /> <script src="jquerry/js/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('#showhideconent').hide(); $('a').click(function(){ $('#showhideconent').show('slow'); }); $('a#close').click(function(){ $('#showhideconent').hide('slow'); }) }); $(document).ready(function(){ $('#showhideconent2').hide(); $('a').click(function(){ $('#showhideconent2').show('slow'); }); $('a#close2').click(function(){ $('#showhideconent2').hide('slow'); }) }); $(document).ready(function(){ $('#showhideconent3').hide(); $('a').click(function(){ $('#showhideconent3').show('slow'); }); $('a#close3').click(function(){ $('#showhideconent3').hide('slow'); }) }); $(document).ready(function(){ $('#showhideconent4').hide(); $('a').click(function(){ $('#showhideconent4').show('slow'); }); $('a#close4').click(function(){ $('#showhideconent4').hide('slow'); }) }); </script> </head> <body class="oneColElsCtr" onload="MM_preloadImages('Assignment4b.jpg')"> <div id="container"> <div id="mainContent"> <h1>Bid Page</h1> <h1>Coke Memorbila</h1> <a href="#" id="click">Amber Bottle 1914</a> <div id="box" align="center"> <div id="showhideconent"> <p><a href="coke/Amber1914.shtml"><img src="amber1914.jpg" width="200" height="200" alt="Amber Coke" /></a></p> <p><a href="#" id="close">Close</a> </p> </div> </div> <a href="#" id="click">Amber Bottle 1915</a> <div id="box" align="center"> <div id="showhideconent2"> <p><a href="coke/Amber1915.shtml"><img src="coke/Amber1914.shtml" width="200" height="200" alt="Amber Bottle 1915" /></a></p> <p><a href="#" id="close2">Close</a> </p> </div> </div> <a href="#" id="click">Green 1929</a> <div id="box" align="center"> <div id="showhideconent3"> <p><a href="coke/green1929.shtml"><img src="green1929.jpg" width="200" height="200" alt="Green 1929" /></a></p> <p><a href="#" id="close3">Close</a> </p> </div> </div> <a href="#" id="click">1970s Cans</a> <div id="box" align="center"> <div id="showhideconent4"> <p><a href="coke/tincans.shtml"><img src="coke_tincan.jpg" width="200" height="200" alt="Tin Cans" /></a></p> <p><a href="#" id="close4">Close</a> </p> </div> </div> </body> </html>

    Read the article

  • TortoiseSVN shows red ! decorator for folder, but no files within it are marked with !

    - by Clay Nichols
    I'm new to SVN. I'm using the latest version (svn 1.6.9, TortoiseSVN 1.6.7.18415). Some folders who a red exclamation point next to them. If I drill down, I find a sub folder with ! as well but no files within that are marked with ! (all are either a green checkmark or no icon (because they are Ignored (like .exe files) . What I've tried: Cleanup {reported success} Add {reports nothing to add. All files either under version control has been ignored per the .ignore property. Commit {succeeds} SVNupdate {succeeds} Restarted computer. Some oddities: -I had a bunch of CVS folders (these files were copied over from a PC that was using CVS but we don't need that version history so I didn't import it into SVN). I deleted those CVS\ folders and they are showing up (as unversioned files) when I CheckIn. Any ideas?

    Read the article

  • Spacing from outer space

    - by meo
    I just wonder where is this space between the end of the image and the end of the li's are coming from: http://bluesys.ch/lussy/ its just a simple UL li img code: div#slider { border: 5px solid #fff; } div#slider ul li { border-bottom: 1px solid pink; } div#slider ul li img { border-bottom: 1px solid green; margin: 0; } note that all margins and paddings are set to 0 by my reset.css can someone help me out? I colored the borders that you can see the spacing i speak of. I use firefox.

    Read the article

  • Change write-host output color based on foreach if elseif outcome in Powershell

    - by Emo
    I'm trying to change the color of write-host output based on the lastrunoutcome property of SQL Server jobs in Powershell....as in...if a job was successfull, the output of lastrunoutcome is "Success" in green....if failed, then "Failed" in red. I have the script working to get the desired job status...I just don't know how to change the colors. Here's what I have so far: # Check for failed SQL jobs on multiple servers [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null foreach ($svr in get-content "C:\serverlist2.txt") { $a = get-date $BegDate = (Get-Date $a.AddDays(-1) -f d) + " 12:00:00 AM" $BegDateTrans = [system.datetime]$BegDate write-host $svr $srv=New-Object "Microsoft.SqlServer.Management.Smo.Server" "$svr" $srv.jobserver.jobs | where-object {$_.lastrundate -ge $BegDateTrans -and $_.Name -notlike "????????-????-????-????-????????????"} | format-table name,lastrunoutcome,lastrundate -autosize foreach ($_.lastrunoutcome in $srv.jobserver.jobs) { if ($_.lastrunoutcome = 0) { -forgroundcolor red } else {} } } This seems to be the closest I've gotten...but it's giving me an error of ""LastRunOutcome" is a ReadOnly property." Any help would be greatly appreciated! Thanks! Emo

    Read the article

  • How do I draw an ESB on a SoaML diagram?

    - by dave
    I've recently had to draw some architectural diagrams that feature the use of an Enterprise Service Bus. The ESB is critical, so everyone wants it to show up on the diagram. But since it's the center of what everything is connected to, it really of gets in the way. I settled on trying to use SoaML. I color-coded the request points blue and service points green, to help then stand out. The text names on the ports give you a sense of what talks to what, and it's incredibly obvious that everything goes through the ESB. Can anyone comment on my approach? Any suggestions on something better?

    Read the article

  • Form.ShowDialog() does not show form.

    - by clawson
    I've come across a situation where I try to run a simple line of code in a method Dim res As DialogResult = frmOptions.ShowDialog() but nothing happens. The dialog box will not appear. If I run this method from another location in the code it executes fine (i.e. displays the form in dialog mode and code executes fine thereafter). Hence, it may be the way in which I arrive at this code that is causing my problem, but I cannot see to find what is wrong. When I pause the debugger the line of code is highlighted in green but I can't see to step over it or into it. Any idea what may cause this to happen, or what I should be looking for that might be causing the problem?? Thanks for the help!

    Read the article

  • How do I create regex groups for replacement?

    - by resting
    I have this sample string: Image: SGD$45.32 SKU: 3f3f3 dfdfd grg4t BP 6yhf Pack Size: 1000's Color: Green Price: SGD$45.32 SGD$45... I would like to remove all the prices namely: SGD$45.32 Price: SGD$45.32 SGD$45 I have this expression thats supposed to match the 3 groups: $pattern = '/(Price.+\sSGD\$\d+\.\d{2})(SGD\$\d+\.\d{2})(SGD\$\d+)/'; $new_snippet = preg_replace($pattern, '', $snippet);` But apparently its not working. It works if I replace a single group at a time. But, I'd like to know if it possible to replace all possible matching groups with a single statement. Tried preg_match_all($pattern, $snippet, $matches); to show matches based on the above pattern, but no matches are found if I put all 3 groups together.

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >