Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".


Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]
Quote:
[quote=@username]text[/quote]
[quote]text[/quote]

List:
[ul] [*]item [/ul]
[ol] [*]item [/ol]

URL:
[url]http://url.com[/url]
[url=http://url.com]text[/url]

Image:
[img]http://imageurl.com[/img]

Embed (videos, code, 3D):
[embed]http://url.com[/embed]

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Forum!
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

I cannot take screenshot of the view including a NGLView
Vote this thread:


@burakkilic

Posts: 36

NGLNewbie

Thu, Sep 5 2013


Hi;

I want to save a screenshot of a view including a NGLView and share it on Twitter.

But NGLView's drawToImage function seems doesn't work, and image is blank. Is there any solution for this?

0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, Sep 6 2013


In response to: @burakkilic

Did you try the other "drawTo..." methods?
Try out "drawToData", it also converts the image to the format you want.
0% like this - 0/0

@burakkilic

Posts: 36

NGLNewbie

Fri, Sep 6 2013


In response to: @dineybomfim

No. I tried this code:

-(UIImage*)SaveToAlbum
{
NSData* imgData = [_nglView drawToData:NGLImageFileTypePNG];
UIImage* img = [UIImage imageWithData:imgData];
// Create new offscreen context with desired size
UIGraphicsBeginImageContext(CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height));



// draw another at 0,0 in the context, maybe with an alpha value
UIImage* img2 = [UIImage imageNamed:@"D2_Mutfak.jpg"];
[img2 drawInRect:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];

// draw img at 0,0 in the context
[img drawAtPoint:CGPointZero];

// assign context to UIImage
UIImage *outputImg = UIGraphicsGetImageFromCurrentImageContext();

// end context
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(outputImg, self,@selector(image:didFinishSavingWithError:contextInfo:), nil);
return [self generateWatermarkForImage:outputImg];
}
0% like this - 0/0

@burakkilic

Posts: 36

NGLNewbie

Fri, Sep 6 2013


And one more thing, it is working in Simulator.

@burakkilic said:


In response to:@dineybomfim

No. I tried this code:

-(UIImage*)SaveToAlbum
{
NSData* imgData=[_nglView drawToData:NGLImageFileTypePNG];
UIImage* img=[UIImage imageWithData:imgData];
// Create new offscreen context with desired size
UIGraphicsBeginImageContext(CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height));



// draw another at 0,0 in the context, maybe with an alpha value
UIImage* img2=[UIImage imageNamed:@"D2_Mutfak.jpg"];
[img2 drawInRect:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];

// draw img at 0,0 in the context
[img drawAtPoint:CGPointZero];

// assign context to UIImage
UIImage*outputImg= UIGraphicsGetImageFromCurrentImageContext();

// end context
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(outputImg, self,@selector(image:didFinishSavingWithError:contextInfo:), nil);
return[self generateWatermarkForImage:outputImg];
}


0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, Sep 6 2013


In response to: @burakkilic

Seems you're doing a double work.

Try this out:

NSData* imgData = [_nglView drawToData:NGLImageFileTypePNG];
[data writeToFile:@"local/path/you/want" atomically:YES];
0% like this - 0/0

@burakkilic

Posts: 36

NGLNewbie

Fri, Sep 6 2013


In response to: @dineybomfim

I want to share it on twitter, so I need to use UIImage. And in the background, I have a photo. So first I draw background, and second, I draw NGLView. Simulator do this successfully. I don't understand why.
0% like this - 0/0

@burakkilic

Posts: 36

NGLNewbie

Fri, Sep 6 2013


In response to: @dineybomfim

And yes, I saved it to local path. But there is an empty image.
0% like this - 0/0

@koolou_zeng

Posts: 4

NGLNewbie

Mon, Dec 23 2013


In response to: @burakkilic

same issue, did u get a solution´╝č
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Tue, Dec 24 2013


In response to: @koolou_zeng

It's a bug with the current method. We'll fix it in the next release.
0% like this - 0/0

@yang5664

Posts: 16

NGLNewbie

Tue, Dec 24 2013


In response to: @burakkilic

please reference to
http://nineveh.gl/community/forum/issue_with_getsave_img_with_drawtodata

it may useful...
0% like this - 0/0

@Momeks

Posts: 71

NGLSpecialist

Sat, Mar 1 2014


In response to: @burakkilic

Here is my method works fine on iOS 7 and Device :

I overlay 3D view on an UIImageView then capture that .

- (IBAction)photoLibrary:(id)sender {

UIImage * captured3D = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
captured3D = [_view3D drawToImage];
NSData* data = UIImagePNGRepresentation ( captured3D );
UIImage* pngImage = [UIImage imageWithData:data];

UIImageView *image2 = [[UIImageView alloc]initWithImage:pngImage];
image2.backgroundColor = [UIColor clearColor];
[_imageCapture addSubview:image2];

UIGraphicsBeginImageContextWithOptions(_imageCapture.bounds.size, NO, 0.0);
[_imageCapture.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

//exporting project
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

[self statusMessage:@"Photo Saved"];
}
100% like this - 1/1

@yang5664

Posts: 16

NGLNewbie

Tue, Mar 18 2014


In response to: @burakkilic

please reference to

http://nineveh.gl/community/forum/problem_with_storyboard_nineveygl_image_background_behind_nglview
0% like this - 0/0

@Momeks

Posts: 71

NGLSpecialist

Sat, Apr 12 2014


In response to: @burakkilic

did your problem solved ? I faced with the same problem !
0% like this - 0/0
Technology

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on


Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.