mirror of https://github.com/vitalif/openscad
windows needs binary-mode set for exporting png
parent
d4c15a8fc4
commit
fc72c86185
|
@ -5,7 +5,6 @@
|
|||
// Objective-C with C++, it is a bit different than what's found in a textbook.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include "fbo.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Functions shared by OffscreenContext[platform].cc (or .mm)
|
||||
// #include directly after definition of struct OffscreenContext.
|
||||
// Functions shared by OffscreenContext[platform].cc
|
||||
// #include this directly after definition of struct OffscreenContext.
|
||||
|
||||
void bind_offscreen_context(OffscreenContext *ctx)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ void bind_offscreen_context(OffscreenContext *ctx)
|
|||
*/
|
||||
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
|
||||
{
|
||||
std::ofstream fstream(filename);
|
||||
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
|
||||
if (!fstream.is_open()) {
|
||||
std::cerr << "Can't open file " << filename << " for writing";
|
||||
return false;
|
||||
|
|
|
@ -113,7 +113,7 @@ bool teardown_offscreen_context(OffscreenContext *ctx)
|
|||
*/
|
||||
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
|
||||
{
|
||||
std::ofstream fstream(filename);
|
||||
std::ofstream fstream(filename,std::ios::out|std::ios::binary);
|
||||
if (!fstream.is_open()) {
|
||||
PRINTB("Can't open file \"%s\" for writing", filename);
|
||||
return false;
|
||||
|
|
|
@ -45,7 +45,6 @@ See Also
|
|||
#include <GL/glx.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <sys/utsname.h> // for uname
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <CGDataConsumer.h>
|
||||
#include "imageutils.h"
|
||||
#include <assert.h>
|
||||
|
||||
CGDataConsumerCallbacks dc_callbacks;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize,
|
|||
}
|
||||
|
||||
bool write_png(const char *filename, unsigned char *pixels, int width, int height) {
|
||||
std::ofstream fstream( filename );
|
||||
std::ofstream fstream( filename, std::ios::binary );
|
||||
if (fstream.is_open()) {
|
||||
write_png( fstream, pixels, width, height );
|
||||
fstream.close();
|
||||
|
|
|
@ -386,7 +386,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (png_output_file) {
|
||||
std::ofstream fstream(png_output_file);
|
||||
std::ofstream fstream(png_output_file,std::ios::out|std::ios::binary);
|
||||
if (!fstream.is_open()) {
|
||||
PRINTB("Can't open file \"%s\" for export", png_output_file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue