• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=Richy19;37562047]Do you make it all light or all shadows?[/QUOTE] Like ECrownofFire said for spotlights, and if its a directional light i.e. the sun, you should transform the map to contain the view frustum.(if i remember correctly:)
[QUOTE=Ramdac;37587083]Like ECrownofFire said for spotlights, and if its a directional light i.e. the sun, you should transform the map to contain the view frustum.(if i remember correctly:)[/QUOTE] How do you mean?
Hmm, couldnt find a good picture, so ill try to explain. think about the light as a box drawn around the view fustrum aligned with the direction of the directional light. Then you render it with that as the lights frustum and orthographic projection. Hope this made sense, else ill try to draw a picture :D [img]http://img16.imageshack.us/img16/3839/shadowmap.png[/img] this is a picture from the lights perspective, the red box is the lights frustum, thats just big enough to contain the camera frustum. This way the camera will never see the corner of the shadowmap. This will yield some new problems, the bigger the view frustum is the bigger the shadowmap has to be and you will get very pixelated shadows. The most common solution to this(I think), is to use paralell split shadow mapping. [img]http://img96.imageshack.us/img96/9366/shadowmap2.png[/img] Basically the maps are same resolution but since the view frustrum is devided into multiple furstrums the ones closes to the near plane will get better resolution. this is why you in many games see a resolution change in the shadowmap a bit in front of you.
[QUOTE=Ramdac;37589120]Hmm, couldnt find a good picture, so ill try to explain. think about the light as a box drawn around the view fustrum aligned with the direction of the directional light. Then you render it with that as the lights frustum and orthographic projection. Hope this made sense, else ill try to draw a picture :D[/QUOTE] Hmm, if you have a minute I think a picture would be helpful. Thanks anyway :)
[QUOTE=Ramdac;37589120]Hmm, couldnt find a good picture, so ill try to explain. think about the light as a box drawn around the view fustrum aligned with the direction of the directional light. Then you render it with that as the lights frustum and orthographic projection. Hope this made sense, else ill try to draw a picture :D [img]http://img16.imageshack.us/img16/3839/shadowmap.png[/img] this is a picture from the lights perspective, the red box is the lights frustum, thats just big enough to contain the camera frustum. This way the camera will never see the corner of the shadowmap. This will yield some new problems, the bigger the view frustum is the bigger the shadowmap has to be and you will get very pixelated shadows. The most common solution to this(I think), is to use paralell split shadow mapping. [img]http://img96.imageshack.us/img96/9366/shadowmap2.png[/img] Basically the maps are same resolution but since the view frustrum is devided into multiple furstrums the ones closes to the near plane will get better resolution. this is why you in many games see a resolution change in the shadowmap a bit in front of you.[/QUOTE] The problem with PSSM is that when the camera rotates you get ugly swimming artifacts because of how the frustums are aligned to the view, and not the world. Cascaded shadowmapping solves this by locking the rotation of the cascades so that they only move to encompass the main view, and not lock to its rotation also. [img]http://puu.sh/13at3[/img]
For some reason, this code doesn't write anything to "log_0.txt" when it is supposed to. [code]using (StreamWriter sw = File.AppendText(@"errorlogs/log_0.txt")) { sw.WriteLine("(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "): " + message); }[/code] Thanks :)
So, I'm currently beginning to learn C#, and I've started a basic program to sort of learn everything. Anyway, I've created the first layout, but when one is done using it, I want it to change. Let me explain how it works. I got the idea from SWTOR in which when engaging in a conversation one has several ways to answer, and based upon the answer, one is awarded AP. At least in my version you are. When you've chosen your answer it runs all the code for that specific answer, but I then want to change all of the code right after the player clicks "OK" on the messagebox. How would I do this? Here's a few screenshots, in case you don't quite understand. I find it a bit hard to explain ^^ [t]http://i.imgur.com/s3FMO.png[/t] [t]http://i.imgur.com/V3WhM.png[/t] [t]http://i.imgur.com/zNO8B.png[/t] In the third screenshot, instead of having the same text as in the first screenshot, I want it to change to the next part of the conversation. How would I do this?
[QUOTE=Funley;37593752]For some reason, this code doesn't write anything to "log_0.txt" when it is supposed to. [code]using (StreamWriter sw = File.AppendText(@"errorlogs/log_0.txt")) { sw.WriteLine("(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "): " + message); }[/code] Thanks :)[/QUOTE] Don't most streams require you to flush() or close() them to complete the I/O?
Not if you use "using" I think, then it will close automatically at the end of the scope. I mean: [code]using(MyFacyStream ...) { //Open the stream [Do stuff] } //Close the stream[/code] C# are supposed to be wierd.
In C#, the end of a [b]using[/b] block calls Dispose() on the object in parenthesis. The object must implement IDisposable for the using block to be considered valid. C#'s streams all implement IDisposable, and calling Dispose() chains off to Close(). A using block is just syntactic sugar for this: [csharp] using(Stream s = new Stream()) { DoStuff(s); } [/csharp] [csharp] { Stream s = new Stream(); DoStuff(s); s.Dispose(); } [/csharp] Notice how the bare version has an extra set of brackets, it keeps the object in a separate scope to prevent you from using it after its been disposed.
[QUOTE=Doom;37594765]So, I'm currently beginning to learn C#, and I've started a basic program to sort of learn everything. Anyway, I've created the first layout, but when one is done using it, I want it to change. Let me explain how it works. I got the idea from SWTOR in which when engaging in a conversation one has several ways to answer, and based upon the answer, one is awarded AP. At least in my version you are. When you've chosen your answer it runs all the code for that specific answer, but I then want to change all of the code right after the player clicks "OK" on the messagebox. How would I do this? Here's a few screenshots, in case you don't quite understand. I find it a bit hard to explain ^^ In the third screenshot, instead of having the same text as in the first screenshot, I want it to change to the next part of the conversation. How would I do this?[/QUOTE] You can have several states and at beginning of each state you load the text for the current state into the boxes. Then you store the text in arrays or classes or something. Something like this: [code]switch(currentState) { case 0: loadTextIntoBoxes(0); switch(answer) { case 0: currentState = 1; break; case 1: currentState = 2; break; //... } break; case 1: //... }[/code] That is the simplest solution I can come up with. A more fancy solution would be to load the text from file and save what question each answer lead to. [QUOTE=Funley;37593752]For some reason, this code doesn't write anything to "log_0.txt" when it is supposed to. [code]using (StreamWriter sw = File.AppendText(@"errorlogs/log_0.txt")) { sw.WriteLine("(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "): " + message); }[/code] Thanks :)[/QUOTE] Try this [code]using (StreamWriter sw = new StreamWriter(@"errorlogs/log_0.txt", true)) { sw.WriteLine("(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "): " + message); }[/code]
[QUOTE=AlienCat]Try this [code]using (StreamWriter sw = new StreamWriter(@"errorlogs/log_0.txt", true)) { sw.WriteLine("(" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "): " + message); }[/code][/QUOTE] Doesnt that just overwrite whatever there is in the text file? I messed up the quotation thingie :/ [editline]9th September 2012[/editline] Nope, still doesn't write anything.
[QUOTE=robmaister12;37595508]In C#, the end of a [b]using[/b] block calls Dispose() on the object in parenthesis. The object must implement IDisposable for the using block to be considered valid. C#'s streams all implement IDisposable, and calling Dispose() chains off to Close(). A using block is just syntactic sugar for this: [csharp] using(Stream s = new Stream()) { DoStuff(s); } [/csharp] [csharp] { Stream s = new Stream(); DoStuff(s); s.Dispose(); } [/csharp] Notice how the bare version has an extra set of brackets, it keeps the object in a separate scope to prevent you from using it after its been disposed.[/QUOTE] It's not simply syntactic sugar. Using [b]using[/b] also disposes of the object when an exception occurs. You should also close the stream when you're done with it. Try calling [B].Close()[/B] to see if that helps (or [B].Flush()[/B] when you want to commit the changes without closing). If that doesn't help either, maybe you're simply looking in the wrong place for the file. You could try running [url=http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx]Process Monitor[/url] alongside to see exactly where it writes to.
[QUOTE=horsedrowner;37600051]It's not simply syntactic sugar. Using [b]using[/b] also disposes of the object when an exception occurs. You should also close the stream when you're done with it. Try calling [B].Close()[/B] to see if that helps (or [B].Flush()[/B] when you want to commit the changes without closing). If that doesn't help either, maybe you're simply looking in the wrong place for the file. You could try running [url=http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx]Process Monitor[/url] alongside to see exactly where it writes to.[/QUOTE] Completely forgot about that bit, [url=http://msdn.microsoft.com/en-us/library/yh598w02.aspx]according to MSDN[/url], it's actually this: [csharp] { Stream s = new Stream(); try { DoStuff(s); } finally { s.Dispose(); } } [/csharp] And [url=http://msdn.microsoft.com/en-us/library/ms227422.aspx]Stream.Dispose()[/url] does in fact call Close(), but it would never hurt to try and flush the stream manually.
Do anyone know a Java opengl wrapper that can be used for both Android and PC? I removed the one I was making.
[QUOTE=AlienCat;37603588]Do anyone know a Java opengl wrapper that can be used for both Android and PC? I removed the one I was making.[/QUOTE] This is the only one I can think of [url]http://code.google.com/p/libgdx/[/url]
Well, thank you, I was checking it out. While it surly do the job, I think it is too much abstract. Maybe I miss useful good to know details about android development if I use if.
Okay, so I'm working on a take-home lab for my COP2220 class, programming with C. I get it, and it's been super easy so far, though we're very early in. An extra credit question asked this of us: [quote]Write a program that prompts the user to enter an integer and then prints the integer first as a character, then as a decimal, and finally as a float. Use separate print statements. A sample runs is shown below. The number as a character: K The number as a decimal: 75 The number as a float: 0.000000[/quote] This doesn't seem to make any sense to me, especially not from what we've already learned. We've just tapped into using stuff like "scanf(" and everything. I'm not sure how to convert any integer (other than 1-26) into a letter really. I mean, if it's a 2+ digit integer, then it would have different letters instead of just one. We haven't learned booleans or if then statements yet. Otherwise, I might could figure this one out. Here's all I've got right now, didn't seem to work: [code] #include <stdio.h> int main (void) { int integer; printf("Hello, please enter an integer:\t"); scanf("%d",integer); printf("\nThe number as a character: \t%c",integer); printf("\nThe number as a decimal: \t%d",integer); printf("\nThe number as a float: \t\t%f",integer); return 0; } [/code] [editline]9th September 2012[/editline] Dammit
where it says character it can be anything on your keyboard not just letters, stuff like @'#~][{}()./<>... easiest way is something like: char c = (char)myInt; Printing by decimal I take it it means print the whole number, no idea what the float thing means, as in how 75 becomes 0.00000...
[QUOTE=Richy19;37605522]where it says character it can be anything on your keyboard not just letters, stuff like @'#~][{}()./<>... easiest way is something like: char c = (char)myInt; Printing by decimal I take it it means print the whole number, no idea what the float thing means, as in how 75 becomes 0.00000...[/QUOTE] Yeah, I'm with you on that about the float. She's some chinese lady and doesn't seem to know what she's doing. I feel like we're learning with her and not from her. So it's highly possible this question is flawed. I'll try it out though, I appreciate it.
[QUOTE=Juice_Layer;37605417]Okay, so I'm working on a take-home lab for my COP2220 class, programming with C. I get it, and it's been super easy so far, though we're very early in. An extra credit question asked this of us: This doesn't seem to make any sense to me, especially not from what we've already learned. We've just tapped into using stuff like "scanf(" and everything. I'm not sure how to convert any integer (other than 1-26) into a letter really. I mean, if it's a 2+ digit integer, then it would have different letters instead of just one. We haven't learned booleans or if then statements yet. Otherwise, I might could figure this one out. Here's all I've got right now, didn't seem to work: [editline]9th September 2012[/editline] Dammit[/QUOTE] You need an ampersand in order to reference the integer variable: [code]scanf("%d", &integer);[/code]
Actually, would you mind doing a small example of that function? I'm not exactly sure how to implement it. [editline]9th September 2012[/editline] [QUOTE=noctune9;37605573]You need an ampersand in order to reference the integer variable: [code]scanf("%d", &integer);[/code][/QUOTE] True that, my mistake. Forgot to add it in this.
I would suspect that it is a simple as if you type 75, then you should turn it to 75.0000... You can do that by casting the integer to float.
Okay, so I'm almost there. I'm trying to set the number of the floating point equal to that of the integer you must enter. Somehow, the character issue resolved itself. [code] #include <stdio.h> int main (void) { int intDecimal; float intFloat; intFloat = intDecimal; printf("Hello, please enter an integer:\t"); scanf("%d",&intDecimal); printf("\nThe number as a character: \t%c",intDecimal); printf("\nThe number as a decimal: \t%d",intDecimal); printf("\nThe number as a float: \t\t%f",intFloat); return 0; } [/code] The results are similar to that of pressing Alt + (integer here). So if I entered "168" I'd get a "¿" just as if I pressed Alt + 168. However, I don't know what's going on with the float. If I type in "12" as the integer, I get "59" (almost constantly) as the float.
If variable A are set to the number of B, A will not change if B changes. You would have to set A to B again afterwards. However if A points to B, A will change when B does as it actually is the same [del]variable[/del] memory place.
Just set the float equal to the int AFTER you set the value for int. Assignment is always a one-time thing.
[QUOTE=Juice_Layer;37605786]Okay, so I'm almost there. I'm trying to set the number of the floating point equal to that of the integer you must enter. Somehow, the character issue resolved itself. [code] #include <stdio.h> int main (void) { int intDecimal; float intFloat; intFloat = intDecimal; printf("Hello, please enter an integer:\t"); scanf("%d",&intDecimal); printf("\nThe number as a character: \t%c",intDecimal); printf("\nThe number as a decimal: \t%d",intDecimal); printf("\nThe number as a float: \t\t%f",intFloat); return 0; } [/code] The results are similar to that of pressing Alt + (integer here). So if I entered "168" I'd get a "¿" just as if I pressed Alt + 168. However, I don't know what's going on with the float. If I type in "12" as the integer, I get "59" (almost constantly) as the float.[/QUOTE] You dont cast it to a char anywhere, you do the assignment before getting the input and you also need to cast in the assignment try this [cpp] #include <stdio.h> int main (void) { int intDecimal = 0; float intFloat = 0.0f; char intCharacter = ''; printf("Hello, please enter an integer:\t"); scanf("%d",&intDecimal); intFloat = (float)intDecimal; intCharacter = (char)intDecimal; printf("\nThe number as a character: \t%c",intCharacter); printf("\nThe number as a decimal: \t%d",intDecimal); printf("\nThe number as a float: \t\t%f",intFloat); return 0; } [/cpp]
You did his assignment :/
[QUOTE=Richy19;37606016]You dont cast it to a char anywhere, you do the assignment before getting the input and you also need to cast in the assignment try this [cpp] #include <stdio.h> int main (void) { int intDecimal = 0; float intFloat = 0.0f; char intCharacter = ''; printf("Hello, please enter an integer:\t"); scanf("%d",&intDecimal); intFloat = (float)intDecimal; intCharacter = (char)intDecimal; printf("\nThe number as a character: \t%c",intCharacter); printf("\nThe number as a decimal: \t%d",intDecimal); printf("\nThe number as a float: \t\t%f",intFloat); return 0; } [/cpp][/QUOTE] Very helpful. Will try when I get home from work. I appreciate it! Thanks everyone.
Hey uh, can someone show me the basics of having two players connected to each other over a network? I'm trying to find an explanation but I can't seem to find a good example.
Sorry, you need to Log In to post a reply to this thread.