|
Bender: "... and I thought I saw a two!" Fry: "It was just a dream, Bender! There's no such thing as two."
|
# ? Apr 24, 2008 07:06 |
|
|
# ? May 18, 2024 00:58 |
|
TheSleeper posted:When I tried to something like that back when I was in college, I wound up having to search MSDN forever and as I can recall I had to either use something like __getc() and/or some kind of voodoo to force stdin not to wait. I'll try that; I've been working with stdio.h this whole time. We haven't really gotten past the Standard Library.
|
# ? Apr 24, 2008 07:57 |
|
I'm trying to integrate some UNIXy (cygwin) code over to a visual studio project. I've never really dealt with visual studio, or windows programming in general, so I'm having a lot of problems. I'm trying to change a lot of the pthreads calls into windows threads. I've created the thread using AFXBeginThread. But I'm having trouble with the mutex's... It looks like I should be using the "CMutex" object. So I've included avxmt.h which its defined in. But I get these errors: 1>c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxmt.h(81) : error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject' 1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(559) : see declaration of 'CObject::operator =' 1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(529) : see declaration of 'CObject' 1> This diagnostic occurred in the compiler generated function 'CSyncObject &CSyncObject::operator =(const CSyncObject &)' What gives?
|
# ? Apr 24, 2008 07:57 |
|
Jungle Bus posted:I'll try that; I've been working with stdio.h this whole time. We haven't really gotten past the Standard Library. Can you just cheat and say "Press enter to continue"?
|
# ? Apr 24, 2008 13:34 |
|
Harokey posted:<some compiler output> For some reason it seems CObject is not EqualityComparable, except privately. This is possibly a deliberate override of the compiler generated equality operator to prevent it being misused. A quick check of the docs suggests you're going to have to rework any logic that requires checking the equivalence of CSyncObject.
|
# ? Apr 24, 2008 13:39 |
|
Harokey posted:I'm trying to integrate some UNIXy (cygwin) code over to a visual studio project. I've never really dealt with visual studio, or windows programming in general, so I'm having a lot of problems. Unless it's absolutely critical that you use MFC for thread management I recommend using the core Win32 thread management API calls. They're very straight-forward and in my opinion kick the tits off of pthreads. The SDK docs for threads and fibers are particularly good, so an afternoon of reading will more than cover what you need to know to get started.
|
# ? Apr 24, 2008 15:41 |
|
Zombywuf posted:For some reason it seems CObject is not EqualityComparable, except privately. That's the assignment operator, but the rest of your post still stands.
|
# ? Apr 24, 2008 16:07 |
|
Does anyone know of a faster alternative to the standard library vector container? A year or so ago I made a 3D application which relied very heavily on the stl vector and since, a friend has told me how slow vectors are. I'd like to re-work some of the old code and replace the vectors with something similar but more efficient if it means I can eek a few more frames per second out of it. Is there anything faster and more suited for real time 3D applications?
|
# ? Apr 24, 2008 20:19 |
|
Zombywuf posted:For some reason it seems CObject is not EqualityComparable, except privately. This is possibly a deliberate override of the compiler generated equality operator to prevent it being misused. A quick check of the docs suggests you're going to have to rework any logic that requires checking the equivalence of CSyncObject. I only do assignment when I first create the CMutex object. Maybe I'm doing it wrong? code:
|
# ? Apr 24, 2008 20:31 |
|
Citizen Erased posted:Does anyone know of a faster alternative to the standard library vector container? A year or so ago I made a 3D application which relied very heavily on the stl vector and since, a friend has told me how slow vectors are. I'd like to re-work some of the old code and replace the vectors with something similar but more efficient if it means I can eek a few more frames per second out of it. Is there anything faster and more suited for real time 3D applications? http://code.google.com/p/rdestl/ This is a library developed by a guy who worked on The Witcher (and has a pretty decent development blog). I would imagine there's something in here you can cannibalize if optimization's important.
|
# ? Apr 24, 2008 20:38 |
|
Citizen Erased posted:Does anyone know of a faster alternative to the standard library vector container? A year or so ago I made a 3D application which relied very heavily on the stl vector and since, a friend has told me how slow vectors are. I'd like to re-work some of the old code and replace the vectors with something similar but more efficient if it means I can eek a few more frames per second out of it. Is there anything faster and more suited for real time 3D applications? It's more likely that any performance problems are down to your use of allocations rather than choice of an STL container. Also, I'd avoid listening to your friend on matters of performance in future. EDIT: Check out Meyers' Effective STL if they've got a copy in a library near you.
|
# ? Apr 24, 2008 22:10 |
|
Citizen Erased posted:Does anyone know of a faster alternative to the standard library vector container? A year or so ago I made a 3D application which relied very heavily on the stl vector and since, a friend has told me how slow vectors are. I'd like to re-work some of the old code and replace the vectors with something similar but more efficient if it means I can eek a few more frames per second out of it. Is there anything faster and more suited for real time 3D applications? While you really should listen to TSDK first as he knows plenty more about C++ than me, but Boost.Array may be of interest. However before you go nuts are start replacing things, have you profiled your code to determine that the vectors are really a problem?
|
# ? Apr 24, 2008 22:32 |
|
Citizen Erased posted:Does anyone know of a faster alternative to the standard library vector container? A year or so ago I made a 3D application which relied very heavily on the stl vector... If so, it's trivial to implement your own vector class that has three elements. Liberal use of "const" in function prototypes for it will help your compiler optimize it.
|
# ? Apr 24, 2008 22:43 |
|
Scaevolus posted:This is a dumb question, but were most of these vectors representing triples? (<x,y,z>) Oh my lord... I hope that isn't what he was using std::vector for!
|
# ? Apr 24, 2008 22:44 |
|
That Turkey Story posted:Oh my lord... I hope that isn't what he was using std::vector for! How else would you implement a 3-Vector? It's called std::vector for a reason, you know! If you really needed .x, .y, and .z syntax you could instead inherit from std::vector, I guess. If you weren't supposed to use it like that, then why would the STL provide an inner_product function?
|
# ? Apr 24, 2008 23:00 |
|
Drx Capio posted:How else would you implement a 3-Vector? It's called std::vector for a reason, you know! Probably with something that doesn't have a ton of baggage related to dynamic resizing.
|
# ? Apr 24, 2008 23:06 |
|
HB posted:Probably with something that doesn't have a ton of baggage related to dynamic resizing. Well it wouldn't be doing any resizing after init since it's a 3-vector, not an n-vector!
|
# ? Apr 24, 2008 23:08 |
|
TSDK posted:There's nothing intrinsically wrong with using a vector for real-time applications, provided you're not doing something silly with them like re-creating them with push_backs on a per frame basis, or copying them wholesale. In fact, if the vector doesn't resize, then they should be pretty much as fast as a plain array. Nothing like that, from memory I don't think there are any (or many) instances of vector resizing. I'll definately pick up the meyers book though, his 55 ways to improve your C++ was excellent. 6174 posted:While you really should listen to TSDK first as he knows plenty more about C++ than me, but Boost.Array may be of interest. However before you go nuts are start replacing things, have you profiled your code to determine that the vectors are really a problem? I don't have a profiler, I'd be open to any recommendations for a good free profiler though. I was simply going on the advice of someone I thought knew a lot more than I do about C++ Scaevolus posted:This is a dumb question, but were most of these vectors representing triples? (<x,y,z>) Nope, I'm using DirectX and so using the built in D3DVector3 class for that. There are however a few instances of stl::vectors of d3dvector3s just to confuse me when I'm trying to re-read my old code. Thanks for the advice, I'll leave the vectors as they are unless I see some sound reasoning to the contrary then. Saves me a lot of hassle.
|
# ? Apr 24, 2008 23:31 |
|
That Turkey Story posted:Oh my lord... I hope that isn't what he was using std::vector for! To be fair std::vector is a really dumbass name, WTG Bjarne.
|
# ? Apr 25, 2008 00:31 |
|
more falafel please posted:To be fair std::vector is a really dumbass name, WTG Bjarne. It's mathematically sound, in the linear algebra sense, but pretty dumb in the everyday sense. At least 'set' and 'map' are logical on both levels.
|
# ? Apr 25, 2008 00:34 |
|
Harokey posted:I only do assignment when I first create the CMutex object. Maybe I'm doing it wrong? All member objects are constructed during the "initializer list phase" (totally made up and incorrect phrase) of the containing object's constructor using their default constructor unless you specify a different constructor in the initializer list for the containing object. So, the commandMutex member of vrCommData has already been constructed; there's no need to construct it again (unless you want to make your code slower, provided the object provides an assignment operator).
|
# ? Apr 25, 2008 03:08 |
|
There's nothing slow about std::vector; accessing it is exactly as fast as it's possible to be. DId he give any details on why it's slow? Does he just want to insert stuff into the middle of all his data structures?
|
# ? Apr 25, 2008 06:47 |
|
Harokey posted:I only do assignment when I first create the CMutex object. Maybe I'm doing it wrong? As avenging dentist pointed out, I'm a numpty. It was the assignment operator that was declared private. It looks like you can simply remove the line with the assignment as the commandMutex member will have already been constructed with the default constructor.
|
# ? Apr 25, 2008 07:51 |
|
Zombywuf posted:As avenging dentist pointed out, I'm a numpty. It was the assignment operator that was declared private. It looks like you can simply remove the line with the assignment as the commandMutex member will have already been constructed with the default constructor. And it doesn't look like you need to, but if you have to pass constructor arguments to your CMutex, you can do it in the class's initializer list: code:
I always ignored initializer lists because they look ugly and are hard to read and maintain, but they provide some really critical features like the above and arguments to inherited classes' constructors.
|
# ? Apr 25, 2008 15:44 |
|
Okay thanks guys. My problem is that I'm not really experienced with C++ yet, and I don't know much about windows programing either, so when you put the two together I've got a whole lot I'm not comfortable with. Thanks!
|
# ? Apr 25, 2008 17:21 |
|
I'm working on a fractal image for a professor. The image is huge, on the order of 360k px by 36k px. I'm using C++, and due to the image size, I can't simply write to a bitmap canvas. I was wondering if there was a workaround for this. I can get the image drawn on a graphics canvas, and it displays, but I cannot save this. Due to the algorithm being used, it would be a pain to remake it to do it in sections. Is there another program that this would be best implemented (and an image of it saved!) in? The program just draws straight 2d lines, so nothing super complex. Any help?
|
# ? Apr 28, 2008 04:04 |
|
What toolkit are you using for the graphics? How are you trying to save it?
|
# ? Apr 28, 2008 04:17 |
|
Nothing special, just the graphics libraries that come with visual studio. As for how I'm trying to save it, file type doesn't matter, however, the size is very specific for a reason, the fractal is very detailed and needs to be printed on a 20ft x 2ft banner, at 1400dpi, hence the enormous dimensions. After that, jpeg, bmp, gif, xxx doesn't matter, just as long as I can save it. I was looking at using the MFC package to work on it, as I think it has built in save features, although I'm not sure if that will even handle the size all things considered. TLDR: doesn't matter the file type, as long as size/quality is relatively maintained.
|
# ? Apr 28, 2008 04:37 |
|
If you're trying to save it to a file to print, I don't understand why you're even trying to display it on the screen. Use an imaging library, not a GUI one. (I don't know enough about them to know which can handle really large images well, though.)
|
# ? Apr 28, 2008 04:50 |
|
It's true, I don't need to draw it to the monitor at all. However, I was just looking at 2D graphics drawing programs and that was the quickest to get into. I don't need to display it at all, but I still need to know how to save it to some sort of image file.
|
# ? Apr 28, 2008 04:53 |
|
ruden posted:It's true, I don't need to draw it to the monitor at all. However, I was just looking at 2D graphics drawing programs and that was the quickest to get into. I don't need to display it at all, but I still need to know how to save it to some sort of image file. libpng is quite easy to use, and I recommend it. If you're even lazier you can simply save it as a raw image file with interlaced channels - i.e. dump out the color values in a giant blob - and open it with an image editor of your choice as a raw image file. On the other hand, how are you generating it? That's 13 billion pixels - if it's one byte per pixel, that's 13 gigs of RAM. Are you actually getting an image at any point, or are you just drawing lines on a graphics canvas that isn't necessarily represented as a bitmap? If you're doing the latter, this could become quite difficult
|
# ? Apr 28, 2008 07:47 |
|
I have a question about makefiles (this is the closest existing thread to my question that I know of) So, I'm asked to edit my makefile such that it can accept an input file from the command line like so: make input1.txt would compile things normally, using input1.txt however way I like. So, this is most likely because I am make-stupid, but is this even possible? If so, how would I go about doing it?
|
# ? Apr 28, 2008 16:25 |
|
As to how I'm drawing it, basically it's nested for loops with graphics.DrawLine() functions. I'm not sure how C++ interprets that exactly, but I'm not drawing pixel for pixel. I'm only using black and white, so color is a minimum too.
|
# ? Apr 28, 2008 17:25 |
|
If you're just drawing lines, one possibility is to just write out an SVG file, and then try to open it up in gimp to convert it to whatever. I *think* gimp handles large files pretty well...
|
# ? Apr 28, 2008 18:01 |
|
ruden posted:As to how I'm drawing it, basically it's nested for loops with graphics.DrawLine() functions. I'm not sure how C++ interprets that exactly, but I'm not drawing pixel for pixel. I'm only using black and white, so color is a minimum too. And is it impossible for this to be done in sections because parts of the image reference other parts? (Which fractal are you drawing?) crazypenguin posted:I *think* gimp handles large files pretty well... No, it doesn't. Try creating a 20,000x20,000 image if you don't believe me. Scaevolus fucked around with this message at 18:21 on Apr 28, 2008 |
# ? Apr 28, 2008 18:14 |
|
Well, I use the word fractal loosely, basically it's imitating reflecting lines in a tube. I could try the SVG, I never thought about using that, and I know it's fairly easy to get into. Is there a limit on image sizes in SVG?
|
# ? Apr 28, 2008 18:33 |
|
ruden posted:Well, I use the word fractal loosely, basically it's imitating reflecting lines in a tube. I could try the SVG, I never thought about using that, and I know it's fairly easy to get into. Is there a limit on image sizes in SVG? How will you be printing this once you have the image file? It might be simpler to work directly in PostScript.
|
# ? Apr 28, 2008 19:00 |
|
Scaevolus posted:You mean grayscale?
|
# ? Apr 28, 2008 19:05 |
|
I'll be taking it to a special printer that prints 1400dpi banners, basically. Very expensive, can't afford to mess it up. The file type doesn't matter, as long as the quality is maintained. I am free to use (almost) any program out there. I have tried Java (couldn't keep that big of an image in memory), and C++ (can't find an easy way to save it). I was thinking about MATLAB, but I don't know too much about it.
|
# ? Apr 28, 2008 19:52 |
|
|
# ? May 18, 2024 00:58 |
|
Have you looked at Boost.GIL (Generic Image Library for C++)? http://www.boost.org/doc/libs/1_35_0/libs/gil/doc/index.html
|
# ? Apr 28, 2008 19:57 |