• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=Richy19;31311368]Cant you just use SFML for the windowing? [editline]24th July 2011[/editline] [url]http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Coll_Detection_Overview.php[/url][/QUOTE] I can't use SFML at the moment, I need freeglut for the OpenGL Superbible 4th Edition. As I said, I compiled the static library but it still says that it's "Missing libc.lib." I read up about it, and it turns out other users had the same problem. It's with the freeglut_static.lib that is supplied with the book not being multi-threaded. I tried compiling my own multi-threaded lib and failed, so I was hoping someone had the multithreaded freeglut_static.lib
[QUOTE=amazer97;31311527]I can't use SFML at the moment, I need freeglut for the OpenGL Superbible 4th Edition.[/QUOTE] No, you don't. [editline]24th July 2011[/editline] You can just as well create the window with SFML.
[QUOTE=esalaka;31311583]No, you don't. [editline]24th July 2011[/editline] You can just as well create the window with SFML.[/QUOTE] I'd prefer freeglut though. :v: Oh well, I'll try to find it somewhere else.
[QUOTE=amazer97;31311311]I tried to compile the freeglut library so I could use it for OpenGL, but it doesn't work. Would anyone be kind enough to upload a freeglut_static.lib file somewhere (multithreaded, one that doesn't rely on libc.lib.) for me?[/QUOTE] Here's what I found in my SDK directory: [url]http://q3k.org/freeglut.tar.bz2[/url] . No clue what version that is.
[QUOTE=q3k;31313910]Here's what I found in my SDK directory: [url]http://q3k.org/freeglut.tar.bz2[/url] . No clue what version that is.[/QUOTE] I've already tried that one, thanks for trying though. It has the same error, "libc.lib not found," while linking. Am I the only one on these forums with the same problem? Edit: I've recompiled the needed library over and over again, using different settings, but it just doesn't work. I've tried about every possible fix, and it still won't work. Can someone please help me? I really want to learn OpenGL.
Anyone tried using (or stumbled upon) this? [url]http://www.sfml-dev.org/forum/viewtopic.php?p=22707[/url] [url]http://mjonir.gantzotaku.com/danmagine/wiki/index.php/Main_Page[/url] I might take a deeper look at this in future.
[QUOTE=ichiman94;31303933]If I pushmatrix then set the camera matrix and render stuff and then I popmatrix and draw hudelememts in xy space, would it work as a regular hud? or did i miss something? Also would it affect the performance?[/QUOTE] You should try. And I don't think it would affect the performance. Personally, when I make a 2D menu I call gluOrtho2d after drawing the 3D stuff and then I draw the menu elements.
Im making a C# application. Im relativity new and Im not sure how to make my Button1_Click function call the public variables from my other class. Any help?
So. In my Hardware Information gatherer I have my Battery class, which currently just has an "Update" function that manually needs to be called. I was wondering if it isn't a bad idea to just initialize it with a Timer the checks the event conditions every interval instead. So should I just stick with the update function that needs to manually be called, or go with the Timer that does away with user-side updating.
Okay, so I've read the entire K&R book of C, and read the entire tutorial of cplusplus.com. I want to go on using SFML and stuff, but I feel like I should learn some of the STL first maybe? Not sure where I would go to learn about the classes it has to offer.
Wait You read K&R C and now you think you are ready to program in... C++? What are you on?
Why does this code give the same number 6 times? and how can I change it so it doesn't? [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] lotto = new int[49]; for(int i = 0; i < lotto.Length; i++) { lotto[i] = i; } for (int i = 0; i < 7; i++) { Random x = new Random(); int y = x.Next(50); Console.WriteLine(lotto[y]); } Console.ReadLine(); } } } [/csharp]
Why are you first writing 0 .. 48 into an array and then reading from it? Can't you just, h, Console.writeLine(x.Next(1, 48)) or something?
Oh that was part of something I was going to try do so that it wouldn't pick the same number twice. Regardless, this doesn't work either. Gives me 6 of the same number every time [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { { for (int i = 0; i < 6; i++) { Random x = new Random(); int a = x.Next(50); Console.WriteLine(a); } Console.ReadLine(); } } } } [/csharp]
uh wait it's because you're creating a random number generator with the same seed every time you go in the for loop. Move Random x = new Random(); out of the loop
Whelp fixed it now. If anyone was wondering; the default seed for the random number if you leave the parameters blank is based on the system time. So in a small program the time doesn't roll over fast enough to get new values. Fixed it by taking the Random x = new Random(); line outside of the for loop. [editline]25th July 2011[/editline] Ah didn't see you'd ninja'd me with the solution anyways :v: Thank you!
I'm also messing with random numbers. Right now I want to draw a few objects on the screen with different X and Y values. So I go and do this: [csharp]Random randX = new Random(); Random randY = new Random();[/csharp] But obviously this wouldn't work that well as both of the are the same, which makes things end up in a diagonal line. I "solved" it by doing: [csharp] static Random randforrand = new Random(); static int crap = randforrand.Next(0, 60000); Random randX = new Random(crap); Random randY = new Random(); [/csharp] As it now should give randX a different seed from randY. Although it looks incredibly ugly, it feels like there are much better and effective ways to do it, do any of you know how?
I want to generate maps for a game I'm making and I want them to be similar to the ones shown in this game here: [url]http://www.tanktrouble.com/[/url] All I have at the moment is two loops to make a square grid map with the chosen grid size, I just need an example of an algorithm similar to the one above :smile:
[QUOTE=Swebonny;31335515]I'm also messing with random numbers. Right now I want to draw a few objects on the screen with different X and Y values. So I go and do this: [csharp]Random randX = new Random(); Random randY = new Random();[/csharp] But obviously this wouldn't work that well as both of the are the same, which makes things end up in a diagonal line. I "solved" it by doing: [csharp] static Random randforrand = new Random(); static int crap = randforrand.Next(0, 60000); Random randX = new Random(crap); Random randY = new Random(); [/csharp] As it now should give randX a different seed from randY. Although it looks incredibly ugly, it feels like there are much better and effective ways to do it, do any of you know how?[/QUOTE] Well you can do something like this: [csharp] Random randX = new Random(); Thread.Sleep(1000); Random randY = new Random(); [/csharp] "The default seed value is derived from the system clock and has finite resolution. As a result, different Random objects that are created in close succession by a call to the default constructor will have identical default seed values and, therefore, will produce identical sets of random numbers. This problem can be avoided by using a single Random object to generate all random numbers. You can also work around it by modifying the seed value returned by the system clock and then explicitly providing this new seed value to the Random(Int32) constructor. For more information, see the Random(Int32) constructor." [url]http://msdn.microsoft.com/en-us/library/h343ddh9.aspx#Y285[/url]
-snip- Meant for WAYWO
[QUOTE=Swebonny;31335515]I'm also messing with random numbers. Right now I want to draw a few objects on the screen with different X and Y values. So I go and do this: [csharp]Random randX = new Random(); Random randY = new Random();[/csharp] But obviously this wouldn't work that well as both of the are the same, which makes things end up in a diagonal line. I "solved" it by doing: [csharp] static Random randforrand = new Random(); static int crap = randforrand.Next(0, 60000); Random randX = new Random(crap); Random randY = new Random(); [/csharp] As it now should give randX a different seed from randY. Although it looks incredibly ugly, it feels like there are much better and effective ways to do it, do any of you know how?[/QUOTE] Why not just do: [cpp]Random randX = new Random(); Random randY = new Random(randX.Next(0, 60000));[/cpp]
Use one of these [url]http://en.wikipedia.org/wiki/Linear_congruential_generator[/url] the state determines what the next number in the sequence is, so you wont end up with time induced issues [editline]26th July 2011[/editline] [QUOTE=FlashStock;31335728]Well you can do something like this: [csharp] Random randX = new Random(); Thread.Sleep(1000); Random randY = new Random(); [/csharp] [/QUOTE] As solutions go, that one is awful. You are putting a delay into the program when you can solve it quite easily programmatically
[QUOTE=amazer97;31311683]I'd prefer freeglut though. :v: Oh well, I'll try to find it somewhere else.[/QUOTE] Don't be ridiculous, you clearly have never even used freeglut. It's an old, outdated piece of junk which I'm pretty sure the superbible only uses because it's JUST for windowing and input. It takes 10 minutes to convert the tutorial samples to SFML (or whatever you want to use), and you'll learn how to use that library at the same time. I could also give you all the tutorials converted to SFML if you'd like, but they are the superbible 5th edition samples. Alternatively, the issue you're probably having with freeglut is that you aren't linking it properly. It'd be different for whatever compiler/OS you're using, so what I suggest is you look up the solution.
[QUOTE=Swebonny;31335515]I'm also messing with random numbers. Right now I want to draw a few objects on the screen with different X and Y values. So I go and do this: [csharp]Random randX = new Random(); Random randY = new Random();[/csharp] But obviously this wouldn't work that well as both of the are the same, which makes things end up in a diagonal line. I "solved" it by doing: [csharp] static Random randforrand = new Random(); static int crap = randforrand.Next(0, 60000); Random randX = new Random(crap); Random randY = new Random(); [/csharp] As it now should give randX a different seed from randY. Although it looks incredibly ugly, it feels like there are much better and effective ways to do it, do any of you know how?[/QUOTE] I fail to see why you need a random for X and a nother one for Y
[QUOTE=Chris220;31337191]Why not just do: [cpp]Random randX = new Random(); Random randY = new Random(randX.Next(0, 60000));[/cpp][/QUOTE] Yes this is a much better solution.
Why not just make [i]one[/i] Random object and generate two numbers from it? You don't need separate RNGs for X and Y.
I'm trying out C, and why won't this compile? [code] #define test #include<stdio.h>\ int main(){\ printf("i like turtles");\ return 0;\ } [/code]
why are you making main a macro?
[QUOTE=robmaister12;31340882]why are you making main a macro?[/QUOTE] I'm just having fun with the language. :v:
ah, ok. Well you should add one line that consists of "test" so that the preprocessor can go and replace it with the macro.
Sorry, you need to Log In to post a reply to this thread.