(3d object to json to webgl). Will I be able to manipulate skin of that 3d from webgl/javascript? |
Yes, you will be able to manipulate the material.
Take a look at: http://threejs.org/examples/#webgl_materials_cars
As you can see, each car is a single object that also holds informations
about which triangle that model is made of corresponds to which material
that is exported. There are many different ways to control the apperiance
of the object, but the answer remains the same - it is possible, it's up to
you to decide how're you gonna do it.
Hope this helps.
|
Use Canvas in SVG or WebGL for 3D application |
HTML5 / Canvas / SVG are good for static images, but not for a 3D
application that allow movement.
I have tried some months ago to implement a stellar map with HTML5 and also
tried with SVG, but all movement (to scroll the map or see another zone)
are slow.
Different browsers has also a huge impact: for example moving a big image
or moving 100 objects has a very different result in efficiency in Chrome
and Firefox.
WebGl is a simplification of OpenGL for web, which use the graphic cards
like a game and allow very complex 3D application. As an example, Command
and conquer online, or http://www.unrealengine.com/html5/ use webGL.
The problem of webGL is that it requires a compatible browser, and for
example IE does not support it.
If your application does not require to be very browser-comp
|
HTML5 textarea canvas webGL |
In order to set the GLSL shader program you use, you always follow the same
steps:
create the pixel- or vertex shaders with context.createShader
obtain the sourcecodes for the shaders
set the sourcecodes for the shaders through context.shaderSource
compile the shaders with context.compileShader
create a new webgl program with context.createProgram
attach the shaders to the program with context.attachShader
link the shader with context.linkProgram
tell the canvas to use the complete shader program with context.useProgram
Details about these individual steps can be found in any of the countless
WebGL tutorials you can google. The only thing you want to do differently
is step 2 - how to obtain the sourcecodes of the pixel- and the vertex
shader.
Most tutorials store the GLSL sourcecode
|
Emscripten - C++ with pure html5 canvas support (not WebGL) |
According to the Emscripten documentation you can use SDL with C++ to get
at the canvas when you generate Javascript. The SDL conversion is
implemented in native canvas calls.
|
cross-domain image for three.js (canvas/webGL), proxy? |
EUREKA!!! loox like proxy's the way to go,
this did the trick :)
<?php
// PHP Proxy
// Responds to both HTTP GET and POST requests
//
// Author: Abdul Qabiz
// March 31st, 2006
//
// Get the url of to be proxied
// Is it a POST or a GET?
$url = ($_POST['url']) ? $_POST['url'] : $_GET['url'];
$headers = ($_POST['headers']) ? $_POST['headers'] : $_GET['headers'];
$mimeType =($_POST['mimeType']) ? $_POST['mimeType'] : $_GET['mimeType'];
//Start the Curl session
$session = curl_init($url);
// If it's a POST, put the POST data in the body
if ($_POST['url']) {
$postvars = '';
while ($element = current($_POST)) {
$postvars .= key($_POST).'='.$element.'&';
next($_POST);
}
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POST
|
Sencha Touch 2: Message box with buttons: How to align buttons vertically? |
If you only have two buttons in your Ext.Msg.Show, you can achieve the
desired results with 'docked' property. (Like this):
Good Luck!
Here is the updated code:
Ext.Msg.show({
title: 'The title',
message: 'and some text...',
scope: this,
buttons : [
{
docked: 'top',
itemId : 'no',
id: 'no',
text : 'Top button'
},
{
docked: 'bottom',
itemId : 'yes',
id : 'yes',
text : 'Bottom button'
}
],
fn: function(btn) {
if (btn == 'yes'){
//do something
}
}
});
|
How can I get some buttons to align-left and some to align-right inside a DIV? |
try this
http://jsfiddle.net/ANC3H/1/
.align-left{
float:left;
}
.align-right{
float:right;
}
|
Background (canvas) color disappears when rendering multi-mesh object in WebGL |
There are two possibilities:
the white is the default color of the canvas and it is still there because
webGL context is not properly initialized. Check console, if there are some
errors with init, than you found your porblem, if that's not the case then
it's second option
the white is drawn on canvas with no errors and that might happen if your
shaders output the white fragments and you put too big objects, so you
ended up looking at one side of the pyramid/cube and everything else is
being blocked from the view because of that one side.
Looking forward to feedback.
|
wrap text and center align in javascript function by appending & prepending spaces |
Aligning text by inserting space characters works ONLY in a very restricted
environment: fixed-width horizontal space using a monospace font of a
specific, known size. Change any of those parameters (width, font,
font-size) and your alignment will be off.
Alignment should be accomplished with CSS.
|
Difference between Javascript "Math.sin" and WebGL"sin" |
There is not difference sin denotes the sine function.
Make sure you are using the radians.
to convert you may use
var angleInRadians = angleInDegrees * Math.PI / 180;
|
Server side javascript with WebGL? |
I am new to WebGL as well, but I still feel that this is a very advanced
question you are asking. I believe it is an advanced question because of
the scope of answers that exist to do what you are asking and the current
problems related to proprietary WebGL.
If you have done any research into WebGL you will immediately see the need
for Server Side code due to the fact that the WEbGL API code is executed
within the browser and thus freely available to any knowing individual.
This is not a typical circumstance for game developers who are used to
shipping their code compiled.
By making use of server side controls a developer can hide a large amount
of WebGL translations, shaders, and matrices, and still maintain a level of
information hiding on the client side code. However, the game will
|
How to align Buttons under a ListView? |
Try this way
Make your listview wrap_content
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lblAlarmEvents" />
<LinearLayout
android:id="@+id/linearLayoutSetUnsetButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_below="@+id/list">
|
Align buttons two in center one the right |
You can use position:absolute to make sure the Close button doesn't
interfere with centering.
<div style="text-align: center; position:relative; width: 100%;
border-width: 1px 0 0 0; ">
<button id="btn-continue-top-fill">Start</button>
<button id="btn-cancel-top-fill">Abort</button>
<button id="btn-close-top-fill" style="position: absolute; right:
0;">Close</button>
</div>
Fiddle: http://jsfiddle.net/zc7m5/1/
|
android how to align buttons? |
Here is the code
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/top_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First" />
<Button
android:id="@+id/button_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Second" />
<Button
android:id="@+id/button_3"
android:layout_width
|
JavaScript WebGL RGBA array to screen? |
You just uploaded image to WebGL context and that's all. If you want to
display this texture then create shader objects, assign a valid filter to
your texture, create vertex buffer with screen coordinates.
Here is modified code: http://jsfiddle.net/XfyX2/
var w = 128;
var h = 128;
var img = new Uint8Array(w * h * 4);
for (var i = 0; i < img.length; i += 4) {
img[i + 0] = 255; // r
img[i + 1] = 0; // g
img[i + 2] = 0; // b
img[i + 3] = 255; // a
}
var cv = document.getElementById('cv');
var gl = cv.getContext('experimental-webgl');
var tex = gl.createTexture();
var vbo = gl.createBuffer();
var program = gl.createProgram();
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MA
|
How to I align these buttons along the bottom of the screen? |
I would suggest you to change
<LinearLayout
android:layout_width="match_parent"
android:layout_height="305dip"
android:orientation="horizontal">
to
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
|
How to align children items in canvas to print with gridspan |
Setting Grid.SetRow and Grid.SetColumn attached properties works only if
specified object is wrapped in Grid. In your case your mainCanvas1 and
mainCanvas are wrappep in mainCavasFinal. So only mainCavasFinal is
affected by Grid attached properties.
If you want to use Canvas container you can manage its children position
using Canvas methods:
Canvas.SetLeft(mainCanvas, 100);
Canvas.SetTop(mainCanvas, 100);
or you can pring Grid itself, see: Print Grid which generated dynamically
in wpf
|
To align all buttons equally in relative layout |
You need to use a LineaLayout if you want equal sizes. You can just put it
inside of your RelativeLayout. You also need to give the buttons equal
weight. Like here: Equal buttons
|
bootstrap-3 align links and buttons at the bottom of a div |
I solved it. See the new screenshot. I did it by adding 3 different css
classes: bottomaligned, bottomright and bottomleft, so each link now has a
different css class.
.bottomaligned {position:absolute; bottom:0; margin-bottom:7px; left:
0;}
.bottomright {position:absolute; bottom:0; margin-bottom:7px;
margin:7px; right: 0;}
.bottomleft {position:absolute; bottom:0; margin-bottom:7px; left:
100px;}
.fixedheight { height: 200px; width: 243px; position:relative;
border:1px solid;}
This is how the template now looks:
<div class="col-lg-3 col-sm-4 col-6 fixedheight ">
<div>
<div >
<span class="bottomleft"><%= link_to 'edit',
edit_product_path(product), class: "btn btn-danger" %></span>
<span class="bottomright">&
|
How do I get HTML buttons with images in them to line up with text buttons? |
Add vertical-align: top
button {
height: 20px;
vertical-align: top
}
Check this JSFiddle
|
creating a menu/actionbar with buttons text and buttons |
You should look at ActionBarSherlock. It has extensive support and helps
give a more unified Android experience emulating many of the standard
Google Apps on the phone.
Its very customizable allowing you to place the actionbar on the top or the
bottom. Likewise it allows you to place all content contained in the
actionbar wherever you please.
|
Adding "new line"s to text in text supporting objects (i.e Buttons, Rich Text boxs) both in and out of code |
"
" is the escaped character for a line break. So code like:
label.Text = "This is a
button";
Should put the word button on a new line.
Edit:
If you want to do it using the properties window in designer, click on the
arrow on the far right of the text property field and it will open a small
box. If you type multiple lines on that as you would normally (ie actually
pressing enter, not using
) then the component will treat them as new lines and put the new lines in
for you.
|
How can I copy the last 20 rows of a canvas into another canvas by using javascript? |
This should be trivial using getImageData and putImageData:
// get bottom 20 rows from source canvas
var data = src_ctx.getImageData(0, 0, src_ctx.canvas.width, 20);
// put them into the destination canvas
dst_ctx.putImageData(data, 0, 0);
|
WPF C# Canvas Drawing Line connecting buttons |
Whilst you can do it by moving the Canvas around, you might be better off
using the positions of the Buttons themselves on the Canvas.
Essentially, you need to have two sets of coordinates, your LineStart and
LineEnd, which in this case will be obtained from the two different Buttons
you're clicking.
You could use Point location =
((Button)source).TransformToAncestor(Canvas1).Transform(new Point(0, 0)) to
obtain the location of the button being clicked, relative to the parent
Canvas.
You would then need to do a similar thing to find the location of the
original object that you had clicked (which you don't seem to be storing).
You could then simply draw a line between the two calculated Points by
setting the X1, X2, Y1, Y2 values.
Adapting your example, you could do something like this
|
C# Listview adding item with image and text, and align the text to left |
This should solve your problems.
listView1.View = View.Details; // Enables Details view so you can see
columns
listView1.Items.Add(new ListViewItem { ImageIndex = 0, Text = "Image 1" });
// Using object initializer to add the text
|
Using ItemsControl to bind buttons top/left position on canvas Windows Phone |
The best answer I've found for this is to use a RenderTransform in your
datatemplate
<ItemsControl x:Name="itemsControl" ItemsSource="{Binding Tiles}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="{Binding Side}" Height="{Binding Side}"
Background="{Binding BgColor}">
<Button.RenderTransform>
<TranslateTransform X={Binding Left} Y ={Binding Top}/>
</Button.RenderTransform>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
|
Getting text to display to the left and right of a text-align: center |
Simply float all the divs to the left. They will display in order.
<style>
.my-dvis {
float:left;
width:33.33%;
margin:0;
padding:0;
border:none;
}
</style>
<div class="my-divs"></div>
<div class="my-divs"></div>
<div class="my-divs"></div>
|
How to add more Javascript buttons to multiple DIV Buttons |
ID Attribute of html elements is supposed to be unique you have multiple
divs with same id level1item1 so when you select div with JS or jquery the
first div with the id is selected thats whay you see this behavior try to
use the class attribute to assign multiple divs
Samne for level1item2,level1item3,level1item4,level1item5,level1item6 ....
|
align text box and text area at bottom id | |
I'm not sure that I understand you correctly. But I guess you need to
display the textboxes below the text "Other". If that is the case, just try
this:
<table>
<tr>
<td>
<div style="width:200px;height:300px; position:relative">
<div style="position: absolute; bottom:0px;">Other <input
type="text" name="otherlocation"></div>
</div>
</td>
<td>
<div style="width:200px;height:300px; position:relative">
<div style="position: absolute; bottom:0px;">Other <input
type="textarea" name="locationdescription"/></div>
</div>
</td>
</tr>
</table>
Fiddle
|
In HTML5, where is the line between WebGL drawing an non WebGL drawing? |
It's WebGL if they're using a WebGLRenderingContext. See:
https://www.khronos.org/registry/webgl/specs/1.0/
Example 1 from that document shows:
var canvas = document.getElementById('canvas1');
var gl = canvas.getContext('webgl');
|
on change event of text area add text using fabric.js on canvas |
I know this question is a little old but I thought I would try to help out
since I had to solve the exact thing.
// Your Fabric Canvas
var canvas = new fabric.Canvas('YOURCANVASID');
// New event handler to take the value from the textarea and send to the
addText utility function.
$('.add-text').on('click', function(e){
e.preventDefault();
var text = $('#filedset').val();
addText(text);
});
// Watches the keyup event handler in your textarea and updates the
selected text node on canvas while you are typing. Creates a nice effect.
// with whats being typed.
$('#filedset').on('keyup' , function(){
var activeObject = canvas.getActiveObject();
// We do a check to make sure there is an active canvas object, and
see if it's text.
if (activeObject && a
|
Change TextView text when EditText text matches string. No Buttons |
Textwatcher is your solution , if you have problem to implement it plz post
your codes, but here is a sample code to implement Textwatcher and you can
put your if statement in onTextChange() callback function :
TextWatcher filterTextWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int
count,int after)
{
}
public void onTextChanged(CharSequence s,int start, int before,int
count)
{
if(s.equals(testString)){
myText.setText("Finished")
}
}
@Override
public void afterTextChanged(Editable arg0)
{
}
};
EditText filterText =
(EditText)dialog.findViewById(R.id.edtItemFilter);
filterText.addTextChangedListener(filterTextWatcher);
|
Toggle class show div content(buttons and text field) above the text |
Change the position property of your wrapper to relative like shown below
and it should work. (Note: I have changed the top value also).
#wrapper {
position:relative; //modified this
z-index:1;
top:0px; //modified this
bottom:48px;
left:0;
width:100%;
height:100px;
overflow:auto;
}
The difference between absolute and relative is that , when you have
position absolute , it takes the position from the container having
relative position, by default its the body of the page.Here when you give
the position absolute , your elements takes the positioning from the body
, but when you have positioning relative , it takes positioning from
current container #wrapper
Demo
EDIT: This link explains the difference between the various positioning
values.
|
SKIA :: Get Text height of a text inside a canvas |
I once had to look into this myself in the past, this link here should help
you, even though it is java, fonts all work on the same idea as far as I
know.
I assume you will want from the ascender to the baseline, Which is just the
ascent. Or you may want the whole thing from top to bottom which is the
ascent and descent combined,
If you were writing on lined paper, the baseline is the same as the line
you write on, anything above that is the ascent, anything below is the
descent.
I dont know anything about skia, But A quick look into skia, at this link
here, that there is a public member called fAscent in FontMetrics, and
fDescent, Maybe you can use those.
|
Using Text Indent with Text Align |
Change your html to this:
<footer>
<div id="footer-container">
<ul id="footerlist">
<hr>
<li><a href="#">Advertising
Programs</a></li>
<li><a href="#">Business
Solutions</a></li>
<li><a href="#">Privacy &
Terms</a></li>
<li><a href="#">+Google</a></li>
<li style='margin-right: 10px'><a href="#">About
Google</a></li>
</footer>
Or use this css:
#footerlist li:last-child {
margin-right: 10px;
}
|
How to align text within div? |
Add a selector id or class to your text, and add a padding to it.
.aligntext{
padding-left: 40px;
}
JSFiddle: http://jsfiddle.net/QLCeH/4/
Another (probably cleaner) way is grouping the right part (Google title and
text below) in a div and floating it: http://jsfiddle.net/QLCeH/11/
|
Align Text with Image in CSS |
after floated elements you should have a clearing element so that the
floats dont "mix"
CSS
.clearfix {
clear:both;
height:0px;
}
HTML
<div>
<img src="http://lorempixel.com/g/80/80/" />
<p>
Lorem ipsum dolor sit amet,
</p>
</div>
<br class="clearfix" />
<div>
<img src="http://lorempixel.com/g/80/80/" />
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis
autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat, vel illum dolore eu feugi
|
Align Div Text Bottom |
Wrap the content in an absolutely positioned span tag. Then set the div to
position relative. You can then use the bottom property of the span to
adjust its height within the div.
HTML
<h2>Header Two</h2>
<div class="products"><span>Content for class "products" Goes
Here</span></div>
<div class="products"><span>Content for class "products" Goes
Here</span></div>
<div class="products"><span>Content for class "products" Goes
Here</span></div>
<div class="products"><span>Content for class "products" Goes
Here</span></div>
CSS
.products {
width: 191.25px;
height: 191.25px;
margin-left: 15px;
margin-bottom: 15px;
padding: 15px;
background: black;
color: white;
float: left;
text
|
How to align text along an axis? |
try this..
<div class="line">
<div style="width:50%;float:left;text-align:right;"
class="date">16 January 2013</div>
<div style="width:50%;float:left;text-align:left;"
class="text">Here is a line of text.</div>
</div>
div-s ok for you? :D
|
Align text evenly css |
Here are two choices
Fixed-width inline-blocks
Wrap the discrete parts of the conversation in HTML elements, use display:
inline-block and give the ones you need a fixed-width.
It would look something like this
HTML
<ul>
<li class="entry">
<span class="name">Laura:</span>
<span class="comment">Hey!</span>
<span class="meta">← (25/July/2013 5:43
PM)</span>
</li>
<li class="entry">
<span class="name">Austen: </span>
<span class="comment">Love this!!</span>
<span class="meta">← (25/July/2013 5:43
PM)</span>
</li>
CSS
.entry .name {
display: inline-block;
width: 50px;
}
See a working example of this here:
|