1. Post #81
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts

    Neat program.
    I wonder if the slowness is due to iostreams or just the fact that it's a 22MB file.
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Agree Agree x 2Artistic Artistic x 1 (list)

  2. Post #82
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    Do some tests and see which one is faster. Learning matrices is essential knowledge for 3D programming anyway so no harm would be done.


    What you're doing seems to be replicating what the graphics card is already programmed to do, but in a higher level language. So I think it would be unlikely if what you were doing was faster.
    Why are you assuming I don't know how a matrix works?

    GPUs are designed to be very fast at transforming vertices using vector/matrix operations and that's how they should be used. The whole point of using matrix transformations is to make the vertex transformation process streamlined as a whole.
    I've been assuming that sending data to the graphics card is a bottleneck, and relative to uploading 8 times as much per frame, a single extra vector addition per vertex is a piece of cake.

    Even if it is slower, it won't be that much so. Not enough to accuse me of joking like I had said something insane.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 2 (list)

  3. Post #83
    Gold Member
    Naelstrom's Avatar
    June 2010
    2,708 Posts
    Why are you assuming I don't know how a matrix works?
    Because sending a single matrix for scaling, translation, and rotation is much easier than sending a bunch of floats in its place. It seems really tedious for you to do that.
    Reply With Quote Edit / Delete Linux United States Show Events

  4. Post #84
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    Because sending a single matrix for scaling, translation, and rotation is much easier than sending a bunch of floats in its place. It seems really tedious for you to do that.
    No. You send one matrix (16 floats) that is constructed from the camera's position, rotation and perspective whenever any of the three change, which is at most once a frame.

    Then, for each object, before you draw it you send a single vector with its position in the world.

    In the shader, you just add this translation to each vertex's position before multiplying by the camera's matrix.

    So for the scene you send 16 + 3n floats, and each vertex has one extra vertex addition, which for a complex shader is nothing compared to any other stuff going on.

    This is assuming that all you need to worry about is objects moving, not rotating or scaling etc. In that case I would just resend the MVP matrix for each object.

    Why what I am doing so terrible?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  5. Post #85
    Gold Member

    March 2005
    3,028 Posts
    Just use a damn 'scene' UBO and be done with it.
    Put everything you could possibly ever want in there:
    view, projection, view-projection, inverse view, inverse projection, inverse view-projection, view coordinate, view rotation, inverse view rotation, frustum edge rays (view- and world-space), current time, frame duration, fog parameters, etc.

    You update it once per frame and use it to draw everything. Practically no bandwidth overhead, no matter how many wacky parameters you can come up with.
    Reply With Quote Edit / Delete Windows 7 Show Events Useful Useful x 4Winner Winner x 1Agree Agree x 1 (list)

  6. Post #86
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    To clarify: before I was talking about uploading 1/8th as much data because in my situation objects are only translated on the X/Z plane, so I am sending a vector2.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  7. Post #87
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    No. You send one matrix (16 floats) that is constructed from the camera's position, rotation and perspective whenever any of the three change, which is at most once a frame.

    Then, for each object, before you draw it you send a single vector with its position in the world.

    In the shader, you just add this translation to each vertex's position before multiplying by the camera's matrix.

    So for the scene you send 16 + 3n floats, and each vertex has one extra vertex addition, which for a complex shader is nothing compared to any other stuff going on.

    This is assuming that all you need to worry about is objects moving, not rotating or scaling etc. In that case I would just resend the MVP matrix for each object.

    Why what I am doing so terrible?
    Uhm, you know those few matrices are nothing compared to the 8 GB/s bandwidth of PCI Express 2.0, right?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 2 (list)

  8. Post #88
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    Uhm, you know those few matrices are nothing compared to the 8 GB/s bandwidth of PCI Express 2.0, right?
    You know those few vector additions are nothing compared to the two 4x4 matrix multiplications you have to do on your CPU (not GPU) to construct a new MVP matrix for each object right?

    That's 96 additions and 128 multiplications in total if I recall correctly.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 1 (list)

  9. Post #89
    Gold Member
    Jookia's Avatar
    July 2007
    6,768 Posts
    Uhm, you know those few matrices are nothing compared to the 8 GB/s bandwidth of PCI Express 2.0, right?
    8GB/s divided by 60 frames..
    Reply With Quote Edit / Delete Linux Australia Show Events

  10. Post #90
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    8GB/s divided by 60 frames..
    136mb/frame.

    If you think sending a few floats instead of a single matrix for world positioning, imagine GPU skinning - Each frame, for each animated model, for each bone in the model, you upload a matrix. The GPU then multiplies this FOUR times per VERTEX (depending on the number of weights).
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  11. Post #91
    Gold Member

    March 2005
    3,028 Posts
    8GB/s divided by 60 frames..
    Yes, you only have a budget of 0.137 gigabytes per frame. I dunno how you'll ever fit everything you need in there.
    Reply With Quote Edit / Delete Windows 7 Show Events Late Late x 1 (list)

  12. Post #92
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    Point is, for objects with a small vertex count it's going to be orders of magnitude faster.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  13. Post #93
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    Point is, for objects with a small vertex count it's going to be orders of magnitude faster.
    Yes, but the speed difference there is negligible. There is no reason whatsoever to optimise this unless you're developing for an embedded platform.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Dumb Dumb x 3 (list)

  14. Post #94
    Gold Member

    March 2005
    3,028 Posts
    Orders of magnitude faster in a situation where it doesn't even matter at all.

    Like you can send just X/Y to an object if you're just moving it in the X/Y plane, that's perfectly fine, but performance is a moot point in this situation. Do whatever is easiest for you to work with.
    Reply With Quote Edit / Delete Windows 7 Show Events Agree Agree x 1 (list)

  15. Post #95
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,076 Posts
    If there is barely a performance difference then why call me out on doing it. That is my whole gripe.

    Edited:

    I sincerely hope that this was a crude attempt at comedy. At least I laughed.
    That's an odd way of saying "That could be negligibly slower in some situations, and negligibly faster in others"
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Dumb Dumb x 1 (list)

  16. Post #96
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    Made a portfolio prototype with Löve

    (It's better in motion)

    Then ported it to html5 canvas (let's not start a discussion here; I picked canvas at random to be honest)
    http://guegan.de/
    Needs lotsa optimizing.
    man i bet that looks great with javascript disabled, too
    Reply With Quote Edit / Delete Windows 7 United States Show Events Zing Zing x 2Dumb Dumb x 2Useful Useful x 1 (list)

  17. Post #97
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    man i bet that looks great with javascript disabled, too
    Doesn't look like anything tbh, it just doesn't show up.
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Programming King Programming King x 1Dumb Dumb x 1 (list)

  18. Post #98
    Gold Member
    Loli's Avatar
    April 2008
    2,288 Posts
    Programming competition?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 4Disagree Disagree x 1 (list)

  19. Post #99
    Dennab
    July 2009
    1,603 Posts
    I made an ulam spiral in Löve

    here it is with 100000 numbers(9592 primes):

    Reply With Quote Edit / Delete Windows 7 Portugal Show Events Winner Winner x 2Artistic Artistic x 1 (list)

  20. Post #100
    Richy19's Avatar
    May 2010
    5,392 Posts
    Programming competition?
    Yes, (I would have voted agree but any time I click on any of the ratings it just sends me to the home page)
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Dumb Dumb x 5Informative Informative x 1 (list)

  21. Post #101
    itty-bitty pretty kitty
    Dennab
    September 2008
    9,837 Posts
    We should do an application programming competition for a change.

    I.E. make the best media player, file manager, etc.

    Edited:

    Yes, (I would have voted agree but any time I click on any of the ratings it just sends me to the home page)
    enable javascript
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 9Zing Zing x 2 (list)

  22. Post #102
    false prophet's Avatar
    October 2011
    948 Posts
    Disabling javascript is so 2005.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 15 (list)

  23. Post #103
    Gold Member

    October 2008
    3,838 Posts
    I.E. make the best media player
    I vote for this.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  24. Post #104
    Liquid Helium's Avatar
    October 2010
    114 Posts
    We should do an application programming competition for a change.

    I.E. make the best media player, file manager, etc.

    Edited:



    enable javascript
    This is a good idea, but instead of doing a media player or file manager instead do an application that people could actually end up using, I can't imagine someone using a media player written here over any of the current best ones (maybe I am being cynical). Instead do something like a podcast manager/player or something else were everything out there at the moment is lacking in some big way.

    edit: But seriously I just want someone to make a good standalone podcast manager/player that saves my location when I stop listening half way through a podcast.
    Reply With Quote Edit / Delete Windows 8 United Kingdom Show Events Agree Agree x 3 (list)

  25. Post #105
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    Doesn't look like anything tbh, it just doesn't show up.
    I apologize my sarcasm wasn't accurately portrayed by way of a typical Facepunch-styled snarky comment with all of the trimmings: lack of capital letters, ignoring punctuation, and brevity.

    My point is that it's a bad approach, and evokes the taste of a slightly more modern and compliant rendition to that of a Flash production.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  26. Post #106
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    I apologize my sarcasm wasn't accurately portrayed by way of a typical Facepunch-styled snarky comment with all of the trimmings: lack of capital letters, ignoring punctuation, and brevity.

    My point is that it's a bad approach, and evokes the taste of a slightly more modern and compliant rendition to that of a Flash production.
    Here's why you're wrong.

    Javascript works on basically every platform other than extremely old cellphones, and works like a 'native' page. On Android for instance flash feels shoddy for ANYTHING but watching videos, but Javascript works mostly as it's supposed to.

    Javascript is a lot less hoggy, slow, and generally shitty than flash. Again, it feels like a 'native' page.

    Javascript is standardized.

    Need I go on really?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 2Agree Agree x 1 (list)

  27. Post #107
    Gold Member
    danharibo's Avatar
    July 2006
    4,497 Posts
    Here's why you're wrong.

    Javascript works on basically every platform other than extremely old cellphones, and works like a 'native' page. On Android for instance flash feels shoddy for ANYTHING but watching videos, but Javascript works mostly as it's supposed to.
    If by "works mostly as it's supposed to" you mean "is as slow as the rest of the browser" then I agree.
    disclaimer: I have a 600mhz armv6 Android phone, it's not a rocket.

    He should really try and use as much CSS3 as possible for pages, since CSS works even if javascript is disabled.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 2 (list)

  28. Post #108
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    Here's why you're wrong.

    Javascript works on basically every platform other than extremely old cellphones, and works like a 'native' page. On Android for instance flash feels shoddy for ANYTHING but watching videos, but Javascript works mostly as it's supposed to.

    Javascript is a lot less hoggy, slow, and generally shitty than flash. Again, it feels like a 'native' page.

    Javascript is standardized.

    Need I go on really?
    You can't be wrong about opinions. However, my standpoint is backed by the fact that a site which relies on JavaScript for things like transitional aesthetics is still much more functional than a site which relies entirely on JavaScript and completely ignores the idea of unobtrusive JavaScript, and takes gracefulness out of graceful degradation.

    This type of conversion is appropriate for games. For portfolios, it's rather unnecessary and keeps robots of various types from knowing what is actually on your site.

    JavaScript isn't all of web development. You're implying having it take full precedence is on-par with everything else standardized on the web for their respective appropriate reasons, like semantic objectives, performance concerns, or to alleviate any general cross-browser differences.

    Images are also a standard part of the HTML spec, it doesn't mean people go around making their entire site a giant image with image mapping.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  29. Post #109
    Gold Member
    BlackPhoenix's Avatar
    May 2006
    447 Posts
    disclaimer: I have a 600mhz armv6 Android phone, it's not a rocket
    FYI rockets usually use slow rad-hardened processors. Think 100-200MHz tops (ARM equivalent). Space Shuttle CPU was running at an equivalent of 1MHz. Didn't stop the shuttle from being actually useful.
    Reply With Quote Edit / Delete Windows 7 Russian Federation Show Events Funny Funny x 11Agree Agree x 5Informative Informative x 2Zing Zing x 1 (list)

  30. Post #110
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    FYI rockets usually use slow rad-hardened processors. Think 100-200MHz tops (ARM equivalent). Space Shuttle CPU was running at an equivalent of 1MHz. Didn't stop the shuttle from being actually useful.
    luckily nasa wasn't using js at the time
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 31Zing Zing x 1 (list)

  31. Post #111
    itty-bitty pretty kitty
    Dennab
    September 2008
    9,837 Posts
    Javascript is a lot less hoggy, slow, and generally shitty than flash. Again, it feels like a 'native' page.
    Actually, if you use it right, Flash is speedy.

    Example: Flash's Molehill API vs WebGL
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  32. Post #112
    amazer97's Avatar
    October 2009
    863 Posts
    Decided to try my hand at writing a small kernel again, here what I got after working on it for 2-3 days. Write now all it can do is load the GDT/IDT, enable software / hardware interrupts, and open/use a ram disk with a basic file system I wrote for it. Was in a rush to test it out with real hardware though, so I forgot to put the disk on the USB with the kernel. Here's what I have so far.



    By the way, would anyone else who has written a kernel give me some points on writing a keyboard driver? I tried it and I got as far as the 8042 controller sending back a "success byte" but after that non of the PS/2 keyboards answer back.
    Reply With Quote Edit / Delete Linux United States Show Events Programming King Programming King x 2 (list)

  33. Post #113
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    If by "works mostly as it's supposed to" you mean "is as slow as the rest of the browser" then I agree.
    disclaimer: I have a 600mhz armv6 Android phone, it's not a rocket.

    He should really try and use as much CSS3 as possible for pages, since CSS works even if javascript is disabled.
    Most Javascript works fine on my SGSII, but that is a fairly high-end phone.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 1 (list)

  34. Post #114
    Gold Member
    Darwin226's Avatar
    January 2009
    4,125 Posts
    If there is barely a performance difference then why call me out on doing it. That is my whole gripe.

    Edited:



    That's an odd way of saying "That could be negligibly slower in some situations, and negligibly faster in others"
    Sorry, I know the argument is over but if you send the vector to the GPU which then has to construct a matrix from it, wouldn't that happen every frame FOR EVERY VERTEX?

    Or are you not using matrices for translation at all?
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events

  35. Post #115
    itty-bitty pretty kitty
    Dennab
    September 2008
    9,837 Posts
    So. Podcast manager programming competition. Someone make it.

    I would but as you all know I'm not very good at organizing.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  36. Post #116
    false prophet's Avatar
    October 2011
    948 Posts
    For portfolios, it's rather unnecessary and keeps robots of various types from knowing what is actually on your site.
    Isn't that what meta tags are for, telling robots and search engines what a page is for and providing alternative pages under special circumstances? Flash would also entirely disable robots from collecting such data.

    Luckily Flash is fast becoming obsolete thanks to HTML5 and Javascript. With modern browsers, there is no reason to disable javascript nowadays.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2Disagree Disagree x 1 (list)

  37. Post #117
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Decided to try my hand at writing a small kernel again, here what I got after working on it for 2-3 days. Write now all it can do is load the GDT/IDT, enable software / hardware interrupts, and open/use a ram disk with a basic file system I wrote for it. Was in a rush to test it out with real hardware though, so I forgot to put the disk on the USB with the kernel. Here's what I have so far.



    By the way, would anyone else who has written a kernel give me some points on writing a keyboard driver? I tried it and I got as far as the 8042 controller sending back a "success byte" but after that non of the PS/2 keyboards answer back.
    you'll want to remap the IRQs away from their usual interrupts because the processor uses the low interrupts for exceptions. Here's the code I always use:

    static void remap_irqs()
    {	
    	// remap IRQ table
    	outb(0x20, 0x11);
    	outb(0xA0, 0x11);
    	outb(0x21, 0x20);
    	outb(0xA1, 0x28);
    	outb(0x21, 0x04);
    	outb(0xA1, 0x02);
    	outb(0x21, 0x01);
    	outb(0xA1, 0x01);
    	outb(0x21, 0x0);
    	outb(0xA1, 0x0);
    }
    

    I have no idea how it works but basically it remaps the IRQs so they start at interrupt 32 rather than interrupt 0.

    You'll then want to attach a handler to interrupt 33 (since the keyboard uses IRQ 1, add 32 to get the interrupt number)

    When the keyboard fires an IRQ, read a byte from port 0x60.

    Remember to write 0x20 to port 0x20 when you're done servicing that IRQ
    Reply With Quote Edit / Delete Mac Australia Show Events Friendly Friendly x 1 (list)

  38. Post #118
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    Isn't that what meta tags are for, telling robots and search engines what a page is for and providing alternative pages under special circumstances? Flash would also entirely disable robots from collecting such data.

    Luckily Flash is fast becoming obsolete thanks to HTML5 and Javascript. With modern browsers, there is no reason to disable javascript nowadays.
    There's also no reason to ignore good practice in web design. What you're both proposing is contradictory to what people would consider forward movement in solidifying web standards; it's not just a set of standards, it's a means of practicing techniques that utilize these new technologies in their intended ways.

    For example, we don't have standards created and utilized to allow people to design better intro pages, because competent developers don't create flash-driven intro pages from the 90's anymore. Because metatags exist doesn't mean you should bastardize their usage; you don't see widespread usage of "View Canvas Site" & "View HTML Site" nowadays, and that's not something designers want either.

    Edited:

    This is too much of a webdev discussion, let's move it there.
    Reply With Quote Edit / Delete Windows Vista United States Show Events

  39. Post #119
    Richy19's Avatar
    May 2010
    5,392 Posts
    enable javascript
    It is, it just started happening randomly 2-3 days ago, anything rating related stopped working
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Dumb Dumb x 2Disagree Disagree x 1 (list)

  40. Post #120
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    It is, it just started happening randomly 2-3 days ago, anything rating related stopped working
    This is true, I don't know why it happens, but it's a little rare and only seems to occur shortly after or around downtime for FP; I don't think he's pulling your leg. Could be cache related.
    Reply With Quote Edit / Delete Windows Vista United States Show Events Agree Agree x 1 (list)