« first day (734 days earlier)      last day (4217 days later) » 

8:15 PM
this bad lip reading stuff is awesome
 
Hi. Larious.
 
Is someone going on a youtube binge?
 
8:32 PM
No one. The lounge is just dead
 
new T[N]; should return a reference to an array when N is a compile time constant :/
 
More inconsistencies?
 
@LucDanton good point
 
OpenGL in Haskell is awesome.
@MooingDuck new always yields a pointer, never a reference.
 
-1
A: What's the difference in C++ between "new int[5]" and "malloc(5 * sizeof(int))"?

Ravindra Bagalenew operator is C++ specific features. it didn't exist in C. malloc is the C way to do things. Most of the time, you won't need to use it in C++. new initializes the allocated memory by calling the constructor (if it's an object). Memory allocated with new should be released with delete (which i...

This idiot needs a few downvotes. He copies an answer to the same question almost verbatim, and now he's denying it.
 
8:47 PM
@MooingDuck Why?
 
@MooingDuck oh new[], nevermind.
 
template<int len> void function(short(&arr)[len]) {}
int main() {function(new short[3]);}
@Collin I can't recall why I thought it was a good idea
 
@Praetorian Just flag it.
 
@MooingDuck I personally find it frustrating that there are very few valid ways to go from a subobject to the enclosing super-object in C++.
Although I'd rather have more ways to go from sub to super rather than change new to return the super object!
 
@Griwes I did, it's been deleted already
 
8:58 PM
I'm gonna create the NGASDD - not give a shit driven development.
4
@Praetorian Well, the answer he copied also seems to be copied from somewhere else.
It's almost a human centipede of plagiarism.
Actually, scratch that; he merged two different answers.
 
@LucDanton without inheritance, yeah. You have to hold a reference to the parent :(
 
@EtiennedeMartel I thought this was the most common form of development
 
@LucDanton How would it know what the "parent" object is?
 
Man
I hate family.
PHP is family.
 
squirrel kickers are drunken marionettes
 
9:05 PM
I have voxel drawing almost done for my game.
 
@Collin How does it know what the "child" object is?
 
Learning OpenGL is like, fun.
 
Ell
@dak wow you work quick
 
Quickly?
Voxels in my game are like, monochrome cubes.
 
@LucDanton Because the parent knows it's type, and where each sub-object it contains is in memory in relation to itself. But if you want the child to know what it's parent is, there needs to be some sort of runtime generated parent information on every child object
 
9:06 PM
And I haven’t even got any perspective.
 
Ell
can I see a screenshot maybe? o.o
oh kk
 
@EtiennedeMartel It is, but in that guy's defense, he linked to the original. But they're both repwhores, they should be voting to close instead of answering.
 
Ell
just seems like you are making progress very quickly
 
@Collin I don't want the child to know what its parent is.
 
@LucDanton Maybe I'm confused about what you want then
 
9:08 PM
@LucDanton ah, but an arbitrary object always knows there's a child. There's no way for an arbitrary object to know if there's a parent.
@Collin you can do it with runtime info on every parent object instead.
 
@MooingDuck I don't care about that. What I care about is when I and the compiler both know there's a parent: then there's still no way (in the general case) to express in the language that.
 
@MooingDuck But where's the RTTI info stored?
 
@Collin I merely said possible, not practical.
 
Assume struct foo: bar { int i; int j; };. Then given foo f; I can go auto& subobject = f.j; but I cannot express the inverse operation.
 
@LucDanton yeah, you have to use the offsetof macro and several static casts. Not pretty.
 
9:11 PM
@LucDanton What situations are those exactly?
 
James Bond is on TV. He’s really a slut.
 
@MooingDuck That puts some heavy-requirements on the type.
 
@LucDanton I asummed that's fine in the situations where both you and the compiler know there's a parent.
 
I don't understand why you brought runtime and storing information and inheritance and whatnot. This all should belong to the object model.
 
@LucDanton you could if those were shorts
 
Ell
9:13 PM
@dak he is a slut?
 
Perhaps there's something I'm missing, but I can't think of any situations where that would be useful and the compiler would know the parent type
 
@LucDanton doing it in the general case requires runtime blah blah. Doing it in a particular "I know it's a child!" case can be done with offsetof +static casts.
 
Why is that 'PHP: The good parts' 61 pages of empty?
5
 
@ThePhD HAHAHAHA
 
@Ell he has sex with another women four times in like two hours.
 
9:14 PM
@MooingDuck ... no it doesn't. The layout is known at compile-time: how else can I go from super-object to suboject?
 
@MooingDuckn... Oh. It's one of those jokes. ... Uh. Just kidding?
 
dynamic_cast & Co. is a different problem altogether, it's not an extension.
 
@LucDanton I think there's communication confusion here.
 
9:15 PM
And stop it with offsetof. It only works for standard-layout classes.
 
RIP Joke.
2012-2012
 
=[
 
=]
 
ಠ◡ಠ
 
I was saying the compiler can't go from child to parent because it can't be certain there is a parent. If you are certain, the only workaround I know of is offsetof (or similar strategy). Otherwise, there are no valid ways.
 
9:17 PM
@LucDanton Can you write up an example? Say we have a hypothetical operator <- which returns the parent.. how do you plan to use it?
 
Ell
=/¦{ )
 
<*)))><
 
Ell
I had chips today :D
 
I had noodles today D:
 
Ell
ooh noodles are good
 
9:19 PM
I had nothing today.
 
@Collin Syntax is going to look iffy with such an operator but referring to the previous: auto p = new int[5]; auto& array = (int(&)[5])<-*p;.
 
@Rapptz Creepy face.
 
Yeah that syntax is not going to work.
 
yeah
I guess I can't think of any situation where the compiler would know what the parent is without you have the parent there
 
you'd need an object, it's name, and the parent type, to get the result. You need a ternary operator of some sort.
 
9:20 PM
That would require additional guarantees from new[] strictly speaking. If we had those guarantees already then I feel like static_cast<int(&)[5]>(*p) would be correct.
 
without requiring a pointer to some RTTI on every object anyway
 
I don’t see why you would ever need new and C-arrays in C++ except for dealing with C++ APIs designed by idiots and C APIs.
 
@daknøk even that, can't you get around with vector anyway?
 
std::vector and std::array are enough and they provide a decent interface.
C-arrays provide the most terrible array interface ever.
 
C-arrays don't require size to be explicit which is nice
 
9:23 PM
@daknøk no, no I mean, can't you just create a vector, resize it to what you need, and pass in vector.data() for those APIs?
 
@Pubby std::vector doesn’t either.
@Collin ohh yeah, you can.
 
std::vector isn't static
 
Oh static. VLAs are not standard C++.
 
int foo[] = { 1, 2, 3 };
^ that is what I'm talking about
 
ohh like that :P
Well, Pubby.
 
9:24 PM
@Pubby std::vector<int> foo{1, 2, 3};
 
@MooingDuck not static.
 
1 min ago, by Pubby
std::vector isn't static
 
@daknøk I fail to see that as a problem
 
@Pubby template<class... T> std::array<something, sizeof...(T)> make_array(stuff) { stuff } :D
 
@daknøk why do you need a static array?
 
9:25 PM
You can't take a constant for std::array either iirc.
 
@MooingDuck I don’t, Pubby does.
@Rapptz a constant?
 
@daknøk Why not just use a regular [] ?
 
3 mins ago, by daknøk
C-arrays provide the most terrible array interface ever.
 
Typical use of C array: alias<char[]> { (void(f(get<Indices>(tuple))), 0)... }.
 
@daknøk e.g. const int n = 4; std::array<int,n>
 
9:26 PM
Oh that.
 
@Rapptz Use constexpr, like you should anyway.
 
Well I made a Table<int n> class and I can instantiate it as a const static, which makes it nice. Maybe they can use that?
 
I don't want anything right now
 
template<class T, class... U>
std::array<T, 1 + sizeof...(U)> make_array(T x, U... xs) {
    return std::array<T, 1 + sizeof...(U)>{ std::move(x), std::move(xs)... };
}
^ problemo solvo
No more need for C-arrays, ever.
 
Why have T and U instead of just U?
 
9:28 PM
@daknøk why is T seperate?
 
(and shouldn't that be forward instead?)
 
Strictly speaking std::array<T, 0> is fine.
 
@Pubby Because otherwise it’s difficult to get the type of the first one. You cannot do like, template<class... T> std::array<T[0], sizeof...(T)> or something.
 
@ThePhD std::array
 
9:29 PM
@MooingDuck Oh. That too.
 
@daknøk make the type explicit instead of implicit
 
@MooingDuck Like this?
 
Why is there no std stuff for working with parameter packs :(
 
template<class T, class... U>
std::array<T, sizeof...(U)> make_array(U&&... xs) {
    return std::array<T, sizeof...(U)>{ std::forward<U>(xs)... };
}
 
@daknøk yes. and std::forward
 
9:31 PM
std::forward makes no sense since arrays cannot store references. Or does it make sense?
 
auto data = make_array<std::string>("HI");
 
std::forward always confuses me.
 
Could use typename std::common_type<U...>::type instead of T (or when it's not specified) I suppose. std::common_type is iffy though.
 
@daknøk I'm pretty sure it makes sense.
 
@LucDanton Does that work with mixed constness and references and stuff?
 
9:32 PM
To an extent.
 
template<class... U>
std::array<typename std::common_type<U...>::type, sizeof...(U)> make_array(U&&... xs) {
    return std::array<typename std::common_type<U...>::type, sizeof...(U)>{{ std::forward<U>(xs)... }};
}
 
You're right about references though. Arguably go with storing Decay<T>.
 
I thought boost::variant no longer needed to have a bazzilian void types?
 
Also you need to double-brace: {{ .. }}.
 
@thecoshman it doesn't in C++11.
 
9:33 PM
@MooingDuck hmm... strange... I must be building for 03 then... or the library is just out of date...
 
@thecoshman most boost libraries are still C++03 AFAIK
 
Caveats? C++ is only caveats. :P
 
Sure. This is one of those specific to the question 'I wrote a perfect-forwarding template and want to store a value: now what?'.
 
9:40 PM
@MooingDuck indeed, but what I mean is, boost must not be getting informed that I want it to build as 11 and so it's falling back on on overly complex looking build errors
 
More seriously though if you want to write something in the spirit of the make_foo factories then go with std::decay<T> + std::forward<T>. Won't surprise the user, won't surprise the writer.
@thecoshman Usually those things are left to Boost.Config to detect what features a compiler does or does not support. Perhaps a misdetection in your case?
 
@thecoshman no, I mean, theoretically boost doesn't need the void stuff now that C++11 is out. Someday, someone will hopefully write a C++11 version. (I'm speculating)
 
@LucDanton indeed, perhaps my installation of GCC is not up-to-date
@MooingDuck ah, I thought that they had sorted it out. I guess they are taking to logic, this way works with old compilers and new ones, so why break compatibility
still, I have to put such things aside now, got to get my CV scrubbed and sent away
 
@thecoshman as of Apr 15, 2012, there was no plans to make a variadic version of boost::variant.
 
@MooingDuck yeah, I can understand why they would not bother
though it would be nice
 
9:48 PM
Last time I checked it was still not clear which authors felt more interested in starting from scratch for a C++11 do-over, or were more interested in transitioning.
I have a hard time imagining e.g. Boost.MPL simultaneously available as C++03 and C++11, while benefiting from C++11.
 
My vote would have to be for a do-over from scratch. The whole C++ mindset has evolved.
 
That would mean maintaining separate C++03 and C++11 versions.
Eric Niebler is the kind of workhorse that is already working on a C++11 version though.
 
yeah, it would be nice for a new version of boost, everything built from scratch to take advantage of all the new C++11 stuff. Anything that was in C++03 can be simply left in a 'we will fix any bugs, but performance or feature wise, this is dead' sort of state. Get with the times people!
 
@LucDanton I sortof assumed C++03 would slowly die off as C++11 replaced it. but for a few years, yes.
Also, large chunks of boost are simply not needed in C++11. boost::shared_ptr for instance.
 
indeed
 
9:55 PM
Right, but imagine you invent a super duper convenient feature for your C++11 version, and C++03 users claim it can be implemented for their version and issue a feature request. What do you do?
 
Sometimes, I wish hackers and virus makers would actually be beneficial and just zap computers to newer versions of their development tools.
 
though I would laugh if boost offered a 'make_unique' function
 
@LucDanton ignore them. In the time it takes to port, they'll probably have upgraded to a C++11 compiler.
 
@LucDanton what part of 'bug fixes only' was so hard to understand?
 
Someone writes a patch and put it in the tracker. In fact it's essentially a copy-paste of the C++11 code. What do you do?
 
9:57 PM
@LucDanton reject, 'bug fixes only'
 
@LucDanton does it compile as C++03?
 
Those are the sorts of considerations that were being talked on when I last checked. Which was a month ago because I used to have the Internet back then.
 
@LucDanton I wouldn't deny it, I just wouldn't actively support it.
 
10:10 PM
damn
I made a hot chocolate and it actually tastes chocolatey
 
@DeadMG must have done it wrong
 
@DeadMG ¬_¬ water or milk?
 
water
 
@DeadMG do it again properly!
 
lol
 
10:21 PM
@DeadMG do it with ice and your mouth will overflow because the milkshake is too tasty to swallow.
Also, milk is the tastiest drink.
 
but seriously, best hot chocolate you can do. Get you self some fancy Channel island milk, it's full fat and extra creamy. Use actual cocoa rather then crappy instant shit. A spot of sugar, preferably muscavado. Perhaps a bit of cinnamon. And for the grown ups in the rum, a shot of rum :D
 
I like the close/reopen chain of that post
 
lol
 
@thecoshman Or you could go with actual rum.
 
10:36 PM
@EtiennedeMartel indeed, rum is good
 
Or you could just go with Dutch cow milk.
 
Fuck it, get drunk.
 
May 4 at 17:45, by DeadMG
drinking just costs money and makes you act stupid
And yes, I remember that from May 4th.
 
Why in the sweet tits are you guys so rational all the time?
 
10:39 PM
 
I was trying shit out with quaternions for rotations, realizing I don’t need any rotations in my game. .—.
 
rofl
epic failure :P
 
@SethCarnegie George voted to open and then closed it immediately after
 
My game uses voxels and they are all in parallel.
They never rotate.
.—.
 
@daknøk camera?
 
10:41 PM
Do you use voxels because Minecraft did it?
 
@MooingDuck Camera is always the same, only translates.
 
I don't know why people say that
 
@EtiennedeMartel no, because I’m terrible at modeling.
 
@EtiennedeMartel minecraft doesn't use voxels
@daknøk can't turn the camera?
 
there are no other known techniques for allowing real-time terrain deformation and creation by regular players instead of experts
 
10:41 PM
@MooingDuck Really? Well, well.
 
@MooingDuck no. It’s always the same angle and direction.
 
so there's no choice but to imitate Minecraft
 
@MooingDuck I thought it did.
 
you may as well criticise everyone for copying mouselook
 
I might also want players to be able to destroy the world, but I’m not yet sure about that.
I’m still working on the concept.
 
10:43 PM
@DeadMG Cube 2 has real-time terrain deformation IIRC
 
@MooingDuck I made up for it by voting to close and reopening immediately after
 
only thing I can get for Cube 2 is a shitty horror film
 
@EtiennedeMartel voxels are like pixels. Minecraft has blocks, not voxels. Blocks made from regular 3d meshes.
 
@MooingDuck Oh.
 
10:45 PM
A voxel is a volume element, representing a value on a regular grid in three dimensional space.
 
> Each cube-shaped node in the octree represents a renderable volume, simply referred to as a cube, where each edge of this cube can be lengthened or shortened to deform the cube into a variety of other shapes. Corners of cubes can also be "pushed" or "pulled" to create crude curves. The what you see is what you get realtime editing has enabled level designers to add a lot of detail to maps, while reducing the time spent on actual creation.
> This is in contrast to traditional modern polygon soup 3D engines which take a model generated as an essentially random batch of triangles from an external modelling program and attempt to spatially subdivide the model's triangles after the fact by splitting them to fit into tree structures, such as a BSP tree or even an octree, that require costly pre-processing to build.
> Cube 2's novelty thus lies in that the world representation is the octree structure itself, from which efficient triangle batches are generated for the graphics processing unit to render, without need for expensive and time consuming pre-processing.
 
I’m not sure how I’m going to do particles. I think I’ll just use cubes that decrease in size over time and then disappear.
 
en.wikipedia.org/wiki/Voxel Westwood Studios' Command & Conquer: Tiberian Sun and Command & Conquer: Red Alert 2 use voxels to render most vehicles.
 
the question isn't whether it offers it, but whether Regular People™ could do it
and Minecraft and derived games remain the only proven example of where it can
 
I think I’ll just have a void render_cube(Vector<3> translation, double scale, Program program); function or something. :P
 
10:49 PM
What's the Program a reference to?
Shader Program?
 
Shader program.
 
Ah.
 
@daknøk That doesn't sound very friendly to the GPU
 
Yes, recursion would work. I think std::generate_n() together with a lambda is simpler than recursion. The generator would be something like int i(-2); <:=:>() mutable <% return i += 2; %>Dietmar Kühl 22 mins ago
digraphs? Why?
 
The OpenGL terminology. VITA uses the same terminology too I think.
 
10:50 PM
@Pubby why?
Too many calls?
 
yeah
what you do is put the cube vertices on the GPU once
 
Depends.
 
then you send all the per-instance data at once in a big buffer
then the GPU executes the shader per-instance
 
You can internally batch them until you call a GPUFlush ( void )
 
Per-instance data? Is that like:
 
10:51 PM
translation, scale
 
And maybe color / texture.
 
@DeadMG Yeas, that.
 
when you render N cubes, each cube has Y variables, like, translation.
performing instancing in hardware from an array is vastly faster than making N draw() calls
 
And then I send that to the GPU.
Using a buffer.
 
yep
 
10:52 PM
Translation and scale can be just a stream of Matrices, which Graphics Cards and OpenGL and DirectX have all been updated and optomized to use
 
And then, I loop through all the cubes?
 
There should be Draw*Instanced* .
 
wait, why would you loop through the cubes?
 
How do I instruct the GPU to run the shaders for each cube?
 
it will have a separate function
 
10:53 PM
You only run it once?
 
that is specifically designed for this task
 
So, if I understand correctly.
 
you create two GPU buffers- one with the cube vertices/textures/whatever
one with the instance data
then you call a function which is provided that understands instancing, and you just say how much data is in each instance and how many instances and bookkeeping stuff like that
then it loops through and makes each call for you on the GPU in hardware
 
@DeadMG Ohh OpenGL provides that function?
I though I had to write it myself.
 
should do
hardware instancing has been standard on GPUs since like, 2005 or so
 
10:54 PM
Aight.
 
and OGL should provide native support for it
 
The first GPU Buffer would be something like a Vertex Buffer. You can set that on OpenGL and all, and it should have all cube's geometry.
The second one would be an Instancing Buffer, which is a stream of (most likely) matrices.
 
yep
 
I don’t quite understand the difference between VBOs and VAOs.
 
I'm a DX guy so I can't help you without knowing dafuq a VAO is
 
10:56 PM
Say I have a cube. I only have to upload those vertices once, right? Then I can use the same data for all the cubes I render.
Oh okay. :P
 
I did VBO and VAO. They're nightmarish.
 
@daknøk IIRC VBOs store data like vertices and VAOs store data of the GL state
 
DX is so much nicer in that regard.
 
@daknøk Yes.
the cube's vertices only go across once.
 
And that is 8 vertices, I assume, or 36?
 
10:57 PM
usually 8 for a cube
 
Depends on what you want.
 
but in when considering instancing, the model setup is irrelevant
as in, it's the same as non-instanced
 

« first day (734 days earlier)      last day (4217 days later) »