Cocos2D: hd files not recognized for TMX map - cocos2d-iphone

I'm having issues with -hd suffixed files in Cocos2d. My SD tilesize is 52x52 with a map that's 6 wide x 9 high, and the HD tilesize is 104x104. Everything's resized appropriately, and I have both SD and HD versions of both my TMX map and my tileset.
In the Retina simulator, everything works fine, despite getting the following nonsensical lines in the log:
Filename(sprites-hd.PNG) contains -hd suffix. Removing it. See cocos2d issue #1040
cocos2d: CCFileUtils: Warning HD file not found: sprites-hd.PNG
But on the device, it does what you'd expect given the errors, and uses the original SD file which looks awful and messes up collision detection. It also generates no #1040 errors on the TMX file, and I suspect it's never using the -hd TMX file at all; when I removed it, I never saw a line warning me that it was missing.
What's going on here, and how do I fix it?

Related

CGAL: Hole Filling .exe file is stuck

This is my terminal(result) after running the .exe file. Click the link for the terminal.
It doesn't stop or gives an error. It's stuck like this for hours.
I got my code from here code, but this is the data (.off) I used.
You are probably trying to fill a hole that is too large or that cannot be filled using the 3D Delaunay triangulation search space (which can happen also if you have pinched holes). In CGAL 5.5 (not yet released but available in master), we added the option do_not_use_cubic_algorithm() (doc here) to not use the cubic search space to fill such holes.

Bad quality of images using GDI+ with PostScript driver

I'm developing a program to print images of different formats (BMP, JPEG, EMF, ...) on HDC using C++ and Windows GDI+. Using the MS Publisher Imagesetter driver I can generate a postscript file and through GhostScript functions I obtain the PDF file. If I try to print the following image:
I obtain the following bad quality result with those strange squares (not present on original image):
The part of my code that I used to print the image is:
SetMapMode(hdcPrint,MM_TEXT);
Gdiplus::Graphics graphics(hdcPrint);
graphics.SetPageUnit(Gdiplus::UnitMillimeter);
Gdiplus::Image* image = Gdiplus::Image::FromFile(srPicture->swPathImage);
graphics.DrawImage(image,x,y,w,h);
I tried to print the same image with many drivers and different kind of formats (different from PostScript: PDF, EMF, real printer) and the result is always acceptable (the squares are not present).
Furthermore, I tried to open the bad quality result with a pdf reader different from Adobe Acrobat Reader DC (Wondershare PDFelement and Chrome) and, even then, the result is acceptable.
I also noticed that if the image contains some different shapes (i.e. a big red line, like in the next image) the result is good too.
At this point, I have no idea if the problem is Adobe reader or my implementation.
Is there a differnt way to print different formats images with GDI+ (or pure GDI)?
The PostScript file generated is this.
Well... You haven't supplied either the PostScript or PDF files, which makes it really hard to comment.
Its not completely obvious to me at what point you are getting the image you show, is this what you see on the PDF file ? Is it something you are getting when printing the PDF file to a physical printer ? If its the lattter, how are you printing the PDF file to the printer ?
The JPEG you have supplied a link to is really small (6Kb), are you genuinely trying to use that JPEG file ?
My guess (and in the absence of any files, a guess is all it can be) that you are using an old version of Ghostscript. Old versions would decompress the JPEG image, then recompress the image using whatever filter produced the smallest result, usually JPEG again.
Because JPEG is a lossy format, every time you apply it to an image the quality decreases.
Newer versions of Ghostscript don't decompress the JPEG image data when going to the pdfwrite device, unless other optsions (eg Colour conversion, image downsampling etc) make it neccesary. The current version of Ghostscript is 9.27 and the release of 9.28 is imminent, I'd suggest you try one of those.
Another possibility would be that either the PostScript program has been created in such a way as to degenerate every image smaple to a rectangle, or you are using an extremely old version of Ghostscript where that technique was also used.
Note that none of these would, in my opinion, lead to exactly the result you've pasted here, but the version is certainly worth investigating. Posting the PostScript program file (ie the file you send to Ghostscript) would be more helpful, because it would allow me to at least narrow down where the problem has occured.
[EDIT]
The fault appears to be an intriguing bug in Acrobat.
The PostScript program uses a colour transfer function to invert the colour samples of the RGB JPEG image. (this is a frowned upon practice, its not what transfer functions are for, but its not uncommon). Ghostscript's pdfwrite device preserves the transfer function.
When rendered Ghostscript correctly produces the expected result, Acrobat, however, spectacularly does not, I have no idea what kind of mess they've made which leads to the result you get but its clearly wrong.
If I alter Ghostscript's pdfwrite production settings to Apply transfer functions instead of preserving them:
-c "<</TransferFunctionInfo /Apply>> setdistillerparams" -f PostScript.ps
then the resulting file views correctly in Acrobat. If I modify Adobe Acorbat's settings so that it uses Preserve instead of Apply for transfer functions (look in Settings->Edit Adobe PDF Settings, then the Color tab, and at 'when transfer functions are found', set the drop-down to Preserve instead of Apply) the resulting PDF file renders correctly in Ghostscript, and the same kind of incorrectly in Acrobat as the Ghostscript pdfwrite output file.
In short I'm afraid what you are seeing here is an Acrobat rendering bug, you can work around it by altering the Ghostscript transfer function settings as above but its really not a problem in Ghostscript.

How do I render high quality monochrome text with SDL2_TTF?

I'm writing a game with old school low resolution graphics. I'm using SDL2_TTF to render monochrome text but it doesn't seem to be hinted properly. I set the hinting with TTF_SetFontHinting(font, TTF_HINTING_MONO) and rendered the text with all three rendering functions (TTF_RenderText_Solid, TTF_RenderText_Shaded and TTF_RenderText_Blended) but I'm not happy with the results. Here's the output I'm getting from TTF_RenderText_Solid. The other functions output antialiased text.
And here's the output I want. This is Andale Mono 12pt (same as above) rendered by the Mac Terminal emulator and scaled up 4x.
The quality of the output does matter because the text is scaled up 4x when shown to the player. Why are they different? I thought that FreeType was the de-facto font rendering library so SDL2_TTF and Terminal would both be using it.
Am I simply using the SDL2_TTF library incorrectly?
I didn't want to mess with the SDL2_TTF library to achieve the effect I was looking for so I decided to find a different font that looks better. I found that if I chose a font that looks pixelated and render it at just the right point size everything looks fine.

64bit OpenCV with Visual Studio 2013 - bizarre behaviour for cv::namedWindow()

Currently trying to display a stream from an uEye camera using OpenCV. For this purpose I have Visual Studio 2013 and OpenCV 2.4.9 (64bit) at my disposal. Since things are not yet close to a release I'm using the debug libraries that are shipped with OpenCV (compiled with Visual Studio 2012).
I was trying to memcpy the image data that is returned by the camera to a cv::Mat object. After getting some weird error about a NULL pointer (string name of cvNamedWindow) I decide to check if I can actually run a very basic piece of code - read a PNG image and show it in a window. Well, it's not working... My mistake is probably still in the memcpy that I use but if you read below you will see that I have also tested a case where no camera is involved.
No matter if I give the absolute path of my image or simply point at the file where the EXE is I get an assertion failure from cv::imshow that either the height and/or width are not > 0. One other thing struck me here - the window name was all messed up - weird symbols, blank spaces etc. Nothing to do with what I have assigned as a name: "camOutput"
Further I decided to test things by manually creating a matrix of type CV_8U3 and filling it with black pixels. OpenCV showed the image yet the name of the window was again messed up. This time I was able to read the following, which seems to be some part of a command:
n in DOS mode.$
O_o I have never ever seen such weird behaviour especially when it comes to imshow, imread or namedWindow. Futher I can also not explain why imread returns an empty matrix no matter what I feed it. Tried PNG, JPEG and BMP - always the same crash.
EDIT: I have created an empty C++ project and transferred all my settings from the previous one. Now it's working. Even the memcpy for my uEye camera is fine and I can display the output in an OpenCV window. I have no idea what the problem was with my previous project. Will have to analyze further since the issue might reoccur. I will however leave this questioned opened because of that.

Can't open any files in Code::Blocks application during runtime

I am using Code::Blocks to make an OpenGL program in C++. The program compiles and runs, but the texture is never displayed. I just get an empty grey rectangle against a white background, when there should have been a picture in the grey rectangle.
I first noticed problems when trying to load the images for textures using the Simple OpenGL Image Library (SOIL). I did some digging around in the code of SOIL and found that the program was not opening any files at all. I tried changing image format, creating some random text files to test, and more, but it would not open any files of any type.
I think I may have the files in the wrong directory, but if so, where are they supposed to go? Right now, I have them saved in the same directory as the code.
Somewhere, you are giving paths to the files. These should be relative to the location of the executable. So examples could be this:
someFunction("file.jpg");
Here, the file.jpg should be somewhere like: <project_dir>/bin/Debug/
someFunction("../../file.jpg");
Now the correct location will be: <project_dir>/