Posts

Load single byte to texture in LWJGL/LibGDX -

Load single byte to texture in LWJGL/LibGDX - i have luminance map in libgdx. utilize bytebuffer load pixels, works fine. gdx.graphics.getgl20().glpixelstorei(gl20.gl_unpack_alignment, 1); gdx.graphics.getgl20().glteximage2d(gl20.gl_texture_2d, 0, gl20.gl_luminance, overviewblock.getwidth(), overviewblock.getheight(), 0, gl20.gl_luminance, gl20.gl_unsigned_byte, overviewbuffer); however, have problem understanding how bytes translated floats in glsl. color based on integer, writing bytebuffer works charm. not sure how single byte color. buffer.put((byte)255); this not result in 1.0 value in glsl/opengl, if i'm not mistaken. right way values in glsl between 0 , 1.0, integer ranged 0 - 255? i'm using buffer.write((byte)(integer number & 0xff)) write bytes recommended per comments. libgdx lwjgl

Cocos2d-x / control drawNode from function -

Cocos2d-x / control drawNode from function - i'm trying animate drawnode declared "dotnode" function "helloworld::touchdetector" in code above. but exc_bad_access when click , fired function. (debug area shows: "dotnode cocos2d::drawnode * null 0x0000000000000000" / "this cocos2d::node * null 0x0000000000000000" or that.) does has thought why happens? thought code work because declared drawnode public in helloworld.h, doesn't. (label worked same code.) thanks, helloworld.h #ifndef __helloworld_scene_h__ #define __helloworld_scene_h__ #include "cocos2d.h" class helloworld : public cocos2d::layergradient { public: static cocos2d::scene* createscene(); virtual bool init(); create_func(helloworld); cocos2d::drawnode *dotnode; void touchdetector(double locationx, double locationy); }; #endif // __helloworld_scene_h__ helloworld.cpp #include "helloworldscene.h" using_ns_cc;...

Undefined method? Controller params in Rails 4 -

Undefined method? Controller params in Rails 4 - i getting weirdest error have ever seen, consider next create method: def create post = post.find_by(id: params[:post_id]) @comment = comment.new(comment_create_params) @comment.post_id = post.id #i know line useless have yet refactor. controller_save(@comment) end from here have comment_create params private method defined such: def comment_create_params params.require(:comment).permit(:author, :comment, :parent_id) end now consider next params passed in: params => {"author"=>"157685iyutrewe1wq", "comment"=>"14253647turyerwe", "action"=>"create", "controller"=>"api/v1/comments", "post_id"=>"126"} based on looks correct. running through function should save. till next error: nomethoderror: undefined method `permit' "14253647turyerwe":string i have...

sql - PostgreSQL, return columns with invoice counts for year -

sql - PostgreSQL, return columns with invoice counts for year - 2 tables company invoices i want homecoming following company name | invoice_total_2014 | invoice_total_2013 ---------------------------------------------------------- company | 2000 | 1500 company b | 1000 | 1000 so doing sort of query invoice_total columns date between function. is possible in postgresql? select name, sum( total * (extract(year created_at) = 2014)::integer ) invoice_total_2014, sum( total * (extract(year created_at) = 2013)::integer ) invoice_total_2013 invoice grouping name casting boolean integer results in 0 or 1 or traditional case select name, sum( case extract(year created_at) when 2014 total end ) invoice_total_2014, sum( case extract(year created_at) when 2013 total end ) invoice_total_2013 invoice grouping name sql postgresql postgresql...

javascript - Get window url inside JSON -

javascript - Get window url inside JSON - is there way window's url within json. tried below doesn't working. json used display widget. below snippet of code. cq.wcm.contentfindertab.getresultsboxconfig({ "itemsddgroups": [cq.wcm.editbase.dd_group_asset], "itemsddnewparagraph": { "path": "foundation/components/image", "propertyname": "./filereference" }, "norefreshbutton": true, "tbar": [ cq.wcm.contentfindertab.refresh_button, "->", { "url": "/bin/wcm/contentfinder/asset/viewnew.json"+window.location.href; }, { "baseparams": { /*"defaultmimetype": "image"*/ "mimetype": "image" }, "...

qt - QPushButton resize animation -

qt - QPushButton resize animation - i want animate qpushbutton resize, there way know when button resized , final size can set final value animation? thanks quick @ qt4 documents show class qpropertyanimation can animate properties of widgets. below illustration code in qt documents shows can animate geometry , command initial , final values. qpropertyanimation *animation = new qpropertyanimation(mywidget, "geometry"); animation->setduration(10000); animation->setstartvalue(qrect(0, 0, 100, 30)); animation->setendvalue(qrect(250, 250, 100, 30)); animation->start(); check if works you. qt animation resize qpushbutton

debugging - Is there a bug inside GroupStyle HidesIfEmpty? -

debugging - Is there a bug inside GroupStyle HidesIfEmpty? - i have windows phone 8.1 winrt application. using semanticzoom + listview combination display grouped list through collectionviewsource. when remove items groups (which observablecollections) and start putting items these empty groups debugger breaks , shows "agip.*" @ point reads disable_xaml_generated_break_on_unhandled_exception; used happen while reason not know app exits , debugging stops without error message; why cannot remember exact filename. i have 2 questions: 1) how can debugger work 1 time again i.e. display "agip.*" page , not silently quit? 2) trial , error managed track downwards cause of changing <listview.groupstyle><groupstyle hidesifempty="true" <listview.groupstyle><groupstyle hidesifempty="false" . , voila app works without problems. bug in winrt? ps: can accomplish hidesifempty behaviour binding grouping header visibility .item...