1. Post #601
    Gold Member
    BackwardSpy's Avatar
    May 2008
    6,123 Posts
    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.
    It is, but I can't think of any way to show you how

    Edit:
    Eh, maybe not then. Ignore meee!
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  2. Post #602
    Gold Member
    bean_xp's Avatar
    June 2006
    193 Posts
    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.
    I don't think so, but it's possible with a triangle fan.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  3. Post #603
    Gold Member
    esalaka's Avatar
    July 2007
    9,888 Posts
    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>} ...]]
    (Sorry, I didn't bother learning BNF after 1am Might do it later in BNF or some extension thereof)
    Reply With Quote Edit / Delete Linux Finland Show Events

  4. Post #604
    Richy19's Avatar
    May 2010
    5,269 Posts
    is it possible to access and change content of a video file in C#?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Dumb Dumb x 2 (list)

  5. Post #605
    Follow me on github!
    benjojo's Avatar
    January 2009
    2,552 Posts
    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)
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  6. Post #606
    Wyzard's Avatar
    June 2008
    1,243 Posts
    This seems like a silly question, but it is possible to create a single triangle strip of half a cube (three adjacent faces)?
    It's possible if you use primitive restart or degenerate triangles, but
    it's possible with a triangle fan
    and is simpler and more elegant that way.
    Reply With Quote Edit / Delete Linux United States Show Events

  7. Post #607
    jrj996's Avatar
    July 2009
    1,629 Posts
    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?
    Reply With Quote Edit / Delete Windows Vista United States Show Events

  8. Post #608
    S!nclair's Avatar
    June 2011
    28 Posts
    I'm trying to make a game called "Nyan Sniper", and whenever I play, this happens


    Help?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 3 (list)

  9. Post #609
    Gold Member
    foszor's Avatar
    April 2005
    899 Posts
    I'm trying to make a game called "Nyan Sniper", and whenever I play, this happens


    Help?
    I have to take a shot in the dark here but render the cat first, then then crosshair.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 4 (list)

  10. Post #610
    Gold Member
    Vbits's Avatar
    April 2010
    1,183 Posts
                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;
    

    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.
    Reply With Quote Edit / Delete Windows 7 New Zealand Show Events

  11. Post #611
    IndianCurry's Avatar
    November 2010
    17 Posts
    Can anyone explain why this piece of code


    Gives me this error


    Visual Studio has been really pissing me off lately.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  12. Post #612
    sim642's Avatar
    July 2010
    1,039 Posts
    Can anyone explain why this piece of code


    Gives me this error


    Visual Studio has been really pissing me off lately.
    Show us Bullet.h as well. Maybe you gave a constructor return type there.
    Reply With Quote Edit / Delete Windows Vista Estonia Show Events

  13. Post #613
    Gold Member
    ZeekyHBomb's Avatar
    June 2006
    3,577 Posts
    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?
    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.
    Reply With Quote Edit / Delete Linux Germany Show Events

  14. Post #614
    Gold Member
    noctune9's Avatar
    April 2008
    1,515 Posts
    It's possible if you use primitive restart or degenerate triangles, but

    and is simpler and more elegant that way.
    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.

    Edited:

    Can anyone explain why this piece of code


    Gives me this error


    Visual Studio has been really pissing me off lately.
    Maybe your header contain a type at the last line.
    Reply With Quote Edit / Delete Windows Vista Denmark Show Events

  15. Post #615
    Gold Member
    BackwardSpy's Avatar
    May 2008
    6,123 Posts
    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 }
    As there's no semicolon, it's equivalent to:
    Code:
    class MyClass { stuff } MyClass::MyClass { blah }
    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.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  16. Post #616
    Richy19's Avatar
    May 2010
    5,269 Posts
    Does anyone know how to use external python libraries?
    I want to use OpenCV but I dont know what or where to download
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  17. Post #617
    slashsnemesis's Avatar
    July 2009
    5,288 Posts
    Does anyone know how to use external python libraries?
    I want to use OpenCV but I dont know what or where to download
    http://opencv.willowgarage.com/wiki/
    Reply With Quote Edit / Delete Windows XP United States Show Events

  18. Post #618
    King of the Oil Refinery
    Tobba's Avatar
    December 2008
    6,134 Posts
    -snip-
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  19. Post #619
    S!nclair's Avatar
    June 2011
    28 Posts
    I have to take a shot in the dark here but render the cat first, then then crosshair.


    I :h: you
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 3Funny Funny x 2Programming King Programming King x 1 (list)

  20. Post #620
    Richy19's Avatar
    May 2010
    5,269 Posts
    Yea but what do I do with it?
    I installed this http://sourceforge.net/projects/open...pencv-win/2.3/ the win32 exe
    and I have python 2.7 and 3.2 but none of the OpenCV samples work
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  21. Post #621
    Follow me on github!
    benjojo's Avatar
    January 2009
    2,552 Posts
    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
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  22. Post #622
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    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
    Pass the open mysql object as a pointer, to the thread each time you catch it?
    Reply With Quote Edit / Delete Windows 7 Denmark Show Events

  23. Post #623
    Follow me on github!
    benjojo's Avatar
    January 2009
    2,552 Posts
    Pass the open mysql object as a pointer, to the thread each time you catch it?
    Could you give me a example?
    I cant find anything on doing that with pointers...
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  24. Post #624
    Gold Member
    esalaka's Avatar
    July 2007
    9,888 Posts
    You have object.
    Pass &object to the thread.

    Edited:

    And make sure it stays valid.
    Reply With Quote Edit / Delete Linux Finland Show Events

  25. Post #625
    Follow me on github!
    benjojo's Avatar
    January 2009
    2,552 Posts
    You have object.
    Pass &object to the thread.

    Edited:

    And make sure it stays valid.
    Can I do that with lots 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.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  26. Post #626
    Gold Member
    esalaka's Avatar
    July 2007
    9,888 Posts
    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.
    Reply With Quote Edit / Delete Linux Finland Show Events Agree Agree x 1 (list)

  27. Post #627
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    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.
    But how do I output the u variable as a string (either std::string or char)?

    Edited:

    Note, the "some_string" is of type const char*
    Reply With Quote Edit / Delete Windows 7 Denmark Show Events

  28. Post #628
    Gold Member
    esalaka's Avatar
    July 2007
    9,888 Posts
    boost::uuid::uuid probably has a .str(), .c_str(), .string() or other similar method. Read the manual?

    Edited:

    uuids::uuid*

    Edited:

    http://www.boost.org/doc/libs/1_42_0...20and%20Output
    Reply With Quote Edit / Delete Linux Finland Show Events Friendly Friendly x 1 (list)

  29. Post #629
    Gold Member
    ZeekyHBomb's Avatar
    June 2006
    3,577 Posts
    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

    Edited:

    meh
    Reply With Quote Edit / Delete Linux Germany Show Events Friendly Friendly x 1 (list)

  30. Post #630
    IndianCurry's Avatar
    November 2010
    17 Posts
    Show us Bullet.h as well. Maybe you gave a constructor return type there.
    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.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 2 (list)

  31. Post #631
    Gold Member
    esalaka's Avatar
    July 2007
    9,888 Posts
    Fun fact: GCC gives a warning about that nowadays

    Edited:

    Probably picked up from clang but damn it's useful.
    Reply With Quote Edit / Delete Linux Finland Show Events Agree Agree x 2 (list)

  32. Post #632
    chipset's Avatar
    November 2010
    2,225 Posts
    So I've been meaning to really bog down and learn c++ for serious now for about a year now and all I've got to show for it is being about 3/4 through learncpp.com
    Tutorials are stupid because they're always written by someone very experienced which means what they write makes perfect sense to them so they tend to be vague about things and make stupid analogies.
    I'm tired of tutorials because there's no end to it, I wanna start making things and learning by doing.

    Is there someone who'd like to add me on steam that I can bother with questions? I'll try not to be annoying, promise.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Optimistic Optimistic x 1 (list)

  33. Post #633
    Gold Member
    Parakon's Avatar
    November 2008
    8,502 Posts
    How would I go about a pathfinding system without it being tilebased in flash as2?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  34. Post #634
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    I believe you can use A* for Nodes too, garry did it in the WAYO thread with one of his HTML tests.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  35. Post #635
    Gold Member
    ThePuska's Avatar
    October 2005
    3,330 Posts
    Yeah, grids are a special kind of a graph. A* works for all weighed graphs. In a grid almost every node has exactly 4 edges, and edges in a grid are generally thought to be bidirectional.

    A* doesn't require this - one node can have as many edges as it needs, and the graph can be directed.

    Note that by "edge" I don't mean an edge that separates two tiles. I mean an edge that connects two tiles or nodes; a way between them.

    Edited:

    And also - in a grid, the weighing is usually thought to be a property of the nodes. If some tile in the grid requires longer to cross, then it's because the tile represents slower terrain. But in waypoint graphs, the weighing is thought to be a property of the edges - the weight is mainly affected by the edge's length, and there can be multiple different edges connecting the two nodes, each with a different weight.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  36. Post #636
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,987 Posts
    Something's up with my SFML + OpenGL, it was working before, and I don't know what I did to break it but it is.

    When the game is initialized:
    Code:
    void mvContext::Initialized()
    {
    	//set up opengl
    	rw->SetActive(true);
    
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    	glEnable( GL_BLEND );
    	glOrtho(0.0f, static_cast<float>(rw->GetWidth()), static_cast<float>(rw->GetHeight()), 0.0f, -1.0, 1.0f);
    
    	...
    	code
    }
    Every frame draw:
    Code:
    void mvContext::Draw()
    {
    	State::Draw();
    	
    	rw->Clear();
    	
    	rw->SaveGLStates();
    	{
    		...
    		code
    	}
    	rw->RestoreGLStates();
    	
    	//draw particles
    	for(int i = 0; i < parts.size(); i++)
    	{
    		float halfsize = parts[i].Size / 2.0f;
    
    		glBegin(GL_QUADS);
    			glColor4f(parts[i].Color.R, parts[i].Color.G, parts[i].Color.B, parts[i].Color.A);
    			glVertex2f(parts[i].Position.x - halfsize, parts[i].Position.y - halfsize);
    			glVertex2f(parts[i].Position.x + halfsize, parts[i].Position.y - halfsize);
    			glVertex2f(parts[i].Position.x + halfsize, parts[i].Position.y + halfsize);
    			glVertex2f(parts[i].Position.x - halfsize, parts[i].Position.y + halfsize);
    		glEnd();
    	}
    
    	rw->SaveGLStates();
    	{
    		...
    		code
    	}
    	rw->RestoreGLStates();
    		
    	rw->Display();
    }
    There are no compile-time errors, everything seems fine. But the glBegin(GL_QUADS); in the Draw will not draw.
    It is called with every particle, and every particle seems to be in the correct positions and all.

    In the Draw, all of the "... code" is just SFML drawing so it shouldn't be breaking it (It wasn't before).

    Any hints as to what the problem is?


    before it looked something like this (when it was working)
    now it looks like this
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Artistic Artistic x 1 (list)

  37. Post #637
    Gold Member
    ThePuska's Avatar
    October 2005
    3,330 Posts
    I don't really know but quads are deprecated from at least 3.0 onwards - if you're using a newer version of OpenGL, they're not required to work. If it doesn't work with triangles, the problem's something else.

    And I'd suggest you to call glBegin and glEnd outside of the for-loop

    Edited:

    but glbegin and glend are deprecated too from 3.0 onwards, so who cares
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  38. Post #638
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,987 Posts
    1.1 I'm pretty sure

    It was working earlier, but now it isn't. If I even tried gl_points it still wouldn't show the opengl drawings, just the sfml drawings.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  39. Post #639
    Nigey Nige's Avatar
    June 2010
    1,322 Posts
    I'm getting a nullpointerexception when I try to access my Laser List in my entitymanager class.

    public class EntityManager {
    
    	static public List<Laser> lasers;
    	
    }

    I want to loop through and draw each Laser instance in the list, but I crash when I try to access lasers.

    Edited:

    Here's the code from my RenderManager class:

    		if(!EntityManager.lasers.isEmpty())
    		{
    			for(Laser l : EntityManager.lasers)
    				l.draw();
    		}
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  40. Post #640
    Gold Member

    July 2006
    1,868 Posts
    You probably haven't actually created the list anywhere.

    static public List<Laser> lasers = new List<Laser>();
    Reply With Quote Edit / Delete Windows Vista Finland Show Events