• What do you need help with? V. 3.0
    4,884 replies, posted
  • Avatar of backwardspy
  • [QUOTE=noctune9;30616717]This seems like a silly question, but it is possible to create a single triangle strip of half a cube (three adjacent faces)? I have a triangle strip for a whole cube, but I only need three of the faces.[/QUOTE] It is, but I can't think of any way to show you how :v: Edit: Eh, maybe not then. Ignore meee!
  • Avatar of bean_xp
  • [QUOTE=noctune9;30616717]This seems like a silly question, but it is possible to create a single triangle strip of half a cube (three adjacent faces)? I have a triangle strip for a whole cube, but I only need three of the faces.[/QUOTE] I don't think so, but it's possible with a triangle fan.
  • Avatar of esalaka
  • Can you see anything obviously wrong with this grammar: [code]... means you may repeat last token {} groups tokens | is or ! is not [] means optional 'x' is character literal <LN> = '' <NB> = ' ' | ' ' <ws> = <LN> | <NB> <word> = !<ws> ... <string> = {'"' <word> ... '"' | <word>} [<NB>] <line> = {<string> [<ws>]} ... <LN> <alchemy> = <project> ... <project> = <word> ':' <LN> {<target> ...} <target> = <word> ':' [[<nb>] <dependencies>] <LN> <commands> ... <commands> = <line> ... <dependencies> = [<string> [{<NB> <string>} ...]] [/code] (Sorry, I didn't bother learning BNF after 1am :v: Might do it later in BNF or some extension thereof)
  • Avatar of benjojo
  • Ok, Im using threading to carry out the same task lots of times Anyway When using random numbers in the thread I get the same random number each time in each thread. Is there a easy way to ensure that all the threads get a different random number? Im using this to get random numbers: [code]random.Next(50, 214)[/code]
  • Avatar of Wyzard
  • [QUOTE=noctune9;30616717]This seems like a silly question, but it is possible to create a single triangle strip of half a cube (three adjacent faces)?[/QUOTE] It's possible if you use [url=http://www.opengl.org/wiki/Vertex_Specification#Primitive_Restart]primitive restart[/url] or [url=http://www.gamedev.net/page/resources/_/reference/programming/sweet-snippets/concatenating-triangle-strips-r1871]degenerate triangles[/url], but [QUOTE=bean_xp;30617369]it's possible with a triangle fan[/QUOTE] and is simpler and more elegant that way.
  • Avatar of jrj996
  • Do bools ever return true or false in C++? I always get some random ass number whenever I have it print. Is there any function similiar to 'tostring' or something of that nature?
  • Avatar of S!nclair
  • I'm trying to make a game called "Nyan Sniper", and whenever I play, this happens [img]http://gyazo.com/7cc55b3750beb9f589b4bfc41f6c4a70.png[/img] Help?
  • Avatar of foszor
  • [QUOTE=S!nclair;30622837]I'm trying to make a game called "Nyan Sniper", and whenever I play, this happens [img]http://gyazo.com/7cc55b3750beb9f589b4bfc41f6c4a70.png[/img] Help?[/QUOTE] I have to take a shot in the dark here but render the cat first, then then crosshair.
  • [csharp] double angle = (float)this.Angle; double orgX = 0.5; double orgY = 0.5; double pointX = this.MovementX; double pointY = this.MovementY; double itemX = pointX - orgX; double itemY = pointY - orgY; double itemX1 = itemX * Math.Cos(this.Angle) - itemY * Math.Sin(this.Angle); double itemY1 = itemX * Math.Sin(this.Angle) + itemY * Math.Cos(this.Angle); this.MovementX = itemX1 + orgX; this.MovementY = itemY1 + orgY; [/csharp] This is the code I use in my game to calculate a new vector to move my units using, they are supposed to turn around a central point. Instead they are turning randomly.
  • Avatar of IndianCurry
  • Can anyone explain why this piece of code [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/FuckedUp.png[/IMG] Gives me this error [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/Error.png[/IMG] Visual Studio has been really pissing me off lately.
  • Avatar of sim642
  • [QUOTE=IndianCurry;30624892]Can anyone explain why this piece of code [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/FuckedUp.png[/IMG] Gives me this error [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/Error.png[/IMG] Visual Studio has been really pissing me off lately.[/QUOTE] Show us Bullet.h as well. Maybe you gave a constructor return type there.
  • Avatar of ZeekyHBomb
  • [QUOTE=jrj996;30622767]Do bools ever return true or false in C++? I always get some random ass number whenever I have it print. Is there any function similiar to 'tostring' or something of that nature?[/QUOTE] The random number should be 0 for false and 1 for true. You can output std:boolalpha before outputting the booleans to get the strings "false" and "true" instead.
  • Avatar of noctune9
  • [QUOTE=Wyzard;30620763]It's possible if you use [url=http://www.opengl.org/wiki/Vertex_Specification#Primitive_Restart]primitive restart[/url] or [url=http://www.gamedev.net/page/resources/_/reference/programming/sweet-snippets/concatenating-triangle-strips-r1871]degenerate triangles[/url], but and is simpler and more elegant that way.[/QUOTE] I'm using the geometry shader, so triangle fans are not an option. I guess I could emit two primitives, or use a degenerate triangle instead. Emitting two primitives is probably the simplest way right now. Edit: Or I could emit one of the hidden triangles. [editline]22nd June 2011[/editline] [QUOTE=IndianCurry;30624892]Can anyone explain why this piece of code [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/FuckedUp.png[/IMG] Gives me this error [IMG]http://dl.dropbox.com/u/10995123/ProgrammingShit/Error.png[/IMG] Visual Studio has been really pissing me off lately.[/QUOTE] Maybe your header contain a type at the last line.
  • Avatar of backwardspy
  • That "ctor not allowed a return type" error is usually because you forgot the last semicolon on the class definition. Because it's common to define the constructor first, when the header is "pasted into" the implementation file you end up with something like this: [code]class MyClass{ stuff } MyClass::MyClass() { blah }[/code] As there's no semicolon, it's equivalent to: [code]class MyClass { stuff } MyClass::MyClass { blah }[/code] Here, the "class MyClass{ stuff }" is acting as a return type on the ctor, something that isn't allowed. To fix, just put a semicolon on the closing } of you class declaration.
  • Avatar of Richy19
  • Does anyone know how to use external python libraries? I want to use OpenCV but I dont know what or where to download
  • Avatar of slashsnemesis
  • [QUOTE=Richy19;30629596]Does anyone know how to use external python libraries? I want to use OpenCV but I dont know what or where to download[/QUOTE] [url]http://opencv.willowgarage.com/wiki/[/url]
  • Avatar of S!nclair
  • [QUOTE=foszor;30623742]I have to take a shot in the dark here but render the cat first, then then crosshair.[/QUOTE] [img]http://gyazo.com/e4bde4b2192c7c35c6194e469f757c01.png[/img] I :h: you
  • Avatar of Richy19
  • [QUOTE=slashsnemesis;30630609][url]http://opencv.willowgarage.com/wiki/[/url][/QUOTE] Yea but what do I do with it? I installed this [url]http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/[/url] the win32 exe and I have python 2.7 and 3.2 but none of the OpenCV samples work
  • Avatar of benjojo
  • How do I pass a object (A mysql object) to a thread? Ive got a thread that is being run quite alot of times and so I cant start a connection to the SQL server in each thread... Anyhelp would be really appreciated
  • Avatar of T3hGamerDK
  • [QUOTE=benjojo;30635043]How do I pass a object (A mysql object) to a thread? Ive got a thread that is being run quite alot of times and so I cant start a connection to the SQL server in each thread... Anyhelp would be really appreciated[/QUOTE] Pass the open mysql object as a pointer, to the thread each time you catch it?
  • Avatar of benjojo
  • [QUOTE=T3hGamerDK;30635149]Pass the open mysql object as a pointer, to the thread each time you catch it?[/QUOTE] Could you give me a example? I cant find anything on doing that with pointers...
  • Avatar of esalaka
  • You have object. Pass &object to the thread. [editline]22nd June 2011[/editline] And make sure it stays valid.
  • Avatar of benjojo
  • [QUOTE=esalaka;30636416]You have object. Pass &object to the thread. [editline]22nd June 2011[/editline] And make sure it stays valid.[/QUOTE] Can I do that with [i]lots[/i] of threads? EG, give the same object to lots of threads? Here is some background information on what I am trying to do: At the begging of the application the application starts a connection to the MYSQL server, then it boots up the threads, When one of the threads needs to submit information to the database it makes a query, but I don't want the connection to be made inside the threads because there are lots of them.
  • Avatar of esalaka
  • Yeah you can pass it to lots of threads. I dunno if using it from multiple threads at the same time is a good idea though, so you might want to put it in a critical section or something. Unless the docs say it's threadsafe.
  • Avatar of T3hGamerDK
  • I'm working on a simple system for loading lua files, and to ensure that they haven't been loaded twice, I'm putting the UUID's of each file into some sort of array or something. The latter is a bit loose on what I want, but the UUID thing seems pretty solid. My only concern is this: How do I use the UUID from boost to do something like this? [code] boost::uuids::string_generator gen(some_string); boost::uuid::uuid u(gen); // TODO: std::cout the variable 'u' somehow. [/code] But how do I output the u variable as a string (either std::string or char)? [editline]22nd June 2011[/editline] Note, the "some_string" is of type const char*
  • Avatar of esalaka
  • boost::uuid::uuid probably has a .str(), .c_str(), .string() or other similar method. Read the manual? [editline]22nd June 2011[/editline] uuids::uuid* [editline]22nd June 2011[/editline] [url]http://www.boost.org/doc/libs/1_42_0/libs/uuid/uuid.html#Input%20and%20Output[/url]
  • Avatar of ZeekyHBomb
  • [cpp]std::ostream& operator<<(std::ostream &stream, const boost::uuids::uuid &uuid) { for(const auto value : uuid) //C++98: for(boost::uuids::uuid::const_iterator iter = u.begin(); iter != u.end(); ++iter ) and use *iter instead of value stream << value; return stream; } //std::cout << someUuid; should now work[/cpp] [editline]22nd June 2011[/editline] meh
  • Avatar of IndianCurry
  • [QUOTE=sim642;30625467]Show us Bullet.h as well. Maybe you gave a constructor return type there.[/QUOTE] Sorry for wasting your time, I am an idiot. I forgot to put a semi-colon after the ending bracket of the class. I've recently picked up programming again and keep forgetting the little things.