How can I bind the default FBO in GLKViewController - glkit

I'm a new for OpenGL ES with GLKit, I want to create two FBO for my program. but I don't know how to bind the default FBO, anyone who can help me ?
Any help or advice would be much appreciated.

this problem is basic, you just need add one line like this:
[((GLKView *) self.view) bindDrawable];
this method can reset to GLKit default FBO

Related

React Three Fiber Drei Billboard with Texture

I´m using React Three Fiber with "Drei" and want to use the the billboards. But I could only figure out how to change the color of the billboard, but not how to add a texture.
I tried it like that, but can't find any documentation on billboards and don`t know what arguments i can pass.
<Billboard map={textureBillboard}/>
Here you see how to change color, but not how to add a texture:
https://drei.react-spring.io/?path=/story/abstractions-billboard--billboard-st
Hope someone can help me.
thanks
you can add texture as a meshBasicMaterial:
<Billboard
position={[0,7,1]}
args = {[44,30]}>
<meshBasicMaterial attach="material" map = {billboardTexture}/>
</Billboard>

Creating a GroupBox with _createChildControlImpl()

I tryed to create a group box with the _createChildControlImpl()-Methode but the layout looks like crap as you can see her http://tinyurl.com/odzgy3v
But when I implement it without _createChildControlImpl() it works fine: http://tinyurl.com/kwzvdm2
Could anybody please tell me what's the reason for this? Thanks in advance!
Have a look at your browser console - there is already a hint.
When you introduce child controls qooxdoo can't reuse the former default appearance of widgets because the appearance id changed (from "groupbox" to "widget/groupBox"). So you have to add your own appearance theme (which can simply forward by using an alias):
qx.Theme.define("test.myAwesomeTheme", {
extend : playground.theme.Appearance,
appearances :
{
"widget/groupBox" : "groupbox",
}
});
qx.theme.manager.Appearance.getInstance().setTheme(test.myAwesomeTheme);
I'm extending playground.theme.Appearance here which extends qx.theme.indigo.Appearance which again extends qx.theme.simple.Appearance. And their you have the groubox definition we are forwarding to.
Here is the complete playground sample.
You are supposed to implement _createChildControl, but not call it directly. Instead call getChildControl in your constructor and let it call _createChildControl, if needed, since it is also caching the result.
GroupBox seems to be a bad fit for what you want - it seems to assume identically sized and shaped elements inside its frame sub-widget, when filled from within the implementation of _createChildControl().
Use another Composite() inside the main container instead, add "Registration" as yet another child control of type label as the first child of the custom widget, and things will look much better (although not identical).
Quick and sloppy proof of concept: http://tinyurl.com/m7ykhta

UICollectionViewLayout Examples

Can anybody point me in the right direction to how I could use UICollectionViewLayout to create an interface similar to the Pinterest column layout?
I tried searching online, but it looks like there are not many examples out there yet.
The 1000memories "Quilt" view is pinterest-like and open source: http://blog.1000memories.com/168-opensourcing-quilt, and you can dig through that to see how it works.
If you're looking for a more conceptual overview, here's the basic idea of what you're going to want to do. The easiest thing by far, if you just need a Pinterest-style layout, is to subclass UICollectionViewFlowLayout. You get a lot of layout help from this class, and Pinterest style is within its capabilities. You only need to override one method.
Set up a normal UICollectionView using UICollectionViewFlow layout. A quick way to do this is:
Drag a UIViewController onto a storyboard, drop a UICollectionView on that. Set the classes to match your custom classes, etc. You can use a delegate and create a delegate class here but strictly speaking that is not necessary to achieve JUST the Pinterest flow layout (you will almost definitely want to break the selection responsibility stuff into a delegate class in reality though).
Stub out a data source. Implementing the data source protocol for UICollectionView (http://developer.apple.com/library/ios/#documentation/uikit/reference/UICollectionViewDataSource_protocol/Reference/Reference.html) is trivially simple. Make sure you set a reuse identifier on your UICollectionViewCell. You need:
(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
just return 1 for now;
(NSInteteger)collectionView:numberOfItemsInSection:
hardcode a number for now, make it 20.
– (UICollectionViewCell *)collectionView:cellForItemAtIndexPath:
This is one of the places where subclassing the flow layout's gonna do you a favor. All you really need to do here is call dequeueReusableCellWithReuseIdentifier:forIndexPath: with the index path. If you added a UIImageView or some labels to the cell, this would be a great place to actually assign the image, text, etc.
In the viewController's viewDidLoad instantiate a UICollectionViewFlowLayout and set the UICollectionView's datasource to yours and layout to flowlayout. Remember, this class is a subclass of UICollectionViewViewController.
self.collectionView.dataSource = [[YourDataSource alloc] init];
self.collectionView.collectionViewLayout = [[UICollectionViewFlowLayout alloc] init];
Ok. At this point you should be able to run your app and see some stuff on the screen. This is a whirlwind overview. If you need more details about how to set up ViewControllers and so on there's tons of stuff available about that.
Now comes the important part, Pinterest-izing the flow layout.
First, add a new class that is a subclass of UIViewControllerFlowLayout. Change your ViewController's viewDidLoad to instantiate this class and assign as the UICollectionView's collectionViewLayout.
The method you are going to need to implement is - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect.
Here's the thing: The superclass is going to do almost all the work for you. Your code is going to look something like this:
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
NSArray *attributes = [super layoutAttributesForElementsInRect:rect];
[attributes enumerateObjectsUsingBlock:^(id attr, NSUInteger idx, BOOL *stop) {
float newYCoord = [calculationMethodYouHaveToWriteFor:attr.frame];
attr.frame = CGRectMake(attr.frame.origin.x, newYCoord, attr.size.width, attr.size.height];
}];
}
Pinterest uses fixed-width columns, all you need to do in your calculation method is figure out what column you are in (`attr.origin.x / _columnWidth), and look up the total height in that column from the ivar you've been saving it in. Don't forget to add it to the new object's height and save it back for the next pass.
The flow layout superclass handles: making cells, determining which cells are visible, figuring out the contents size, figuring out the arrangement of the rows in the x direction, assigning index paths to cells. Lots of junk. And overriding that one method lets you fiddle with the y-pos to your heart's desire.
Heres two from github
https://github.com/jayslu/JSPintDemo
https://github.com/chiahsien/UICollectionViewWaterfallLayout
I've used a modified version of Waterfall in a project now, and I'm investigating JSPint now.
I have created a custom uicollectionviewlayout which is used in my personal project. Here is the link. Hope it helps.
https://github.com/johnny0614/YJZAlbumCollectionViewLayout
You can get anything you want from here:
https://github.com/ParsifalC/CPCollectionViewKit
For example(Both these two layouts are custom UICollectionViewLayout):

Unable to write data to the control of other from in VC++ winforms

I am trying to show an image on the pictureBox of the second Form from First Form.
But I am not able to see any output....
My Code of Form1.cpp is like this
#include "SecondForm.h"
SecondForm^ obj=gcnew SecondForm();
System::Drawing::Bitmap ^bmp = gcnew System::Drawing::Bitmap(grf->width,grf->height,grf->widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr)grf->imageData);
obj->pictureBox1->Image=obj->pictureBox1->Image->FromHbitmap(bmp->GetHbitmap());
I don't know what is the problem.....
Can anybody please help me sort our this problem...
Thanks in Advance
Have you tried this simple code -
obj.pictureBox1.Image = bmp; // [You may write the C++ equivalent]
Instead of this -
obj->pictureBox1->Image=obj->pictureBox1->Image->FromHbitmap(bmp->GetHbitmap());

How to replace ClutterTexture with key action?

I want to change the background texture of a Gobject clutter actor whenever it is highlighted. Is there any way i can replace the texture during runtime ?
you can use the clutter_texture_set_* family of functions, like:
clutter_texture_set_from_file
clutter_texture_set_from_rgb_data
clutter_texture_set_area_from_rgb_data
all documented here: http://developer.gnome.org/clutter/stable/ClutterTexture.html

Resources