How can I draw a circle with Clutter? - clutter

I want to draw a circle with clutter but I am unable to figure how can I do that. I am using clutter with vala programming language but an example in c would be sufficient also in case you don't know vala. So how can i do that ?

you can use ClutterCairoTexture, and draw the circle using the Cairo API, if you want to have high-quality, 2D drawing.

Related

Cesium Draw and Measure tools for 2D maps?

I am using Cesium to display a strictly 2D map in the browser (wrapped in React using the Resium library).
I am interested in giving the user the option to draw lines\polygons, and to measure the distances between two points or the area withing the polygon.
Basially, I want precisely this OpenLayeres example, but in Cesium: https://openlayers.org/en/latest/examples/measure.html
How would one go about doing it?
Thank you
I was doing some research on cesium drawing tool library.
It wasn't same as the one you asked but you can use it for your need. you can use for 2D and 3D maps. it gives all basic functionalities like draw circle, polygon, add marker, draw line, calculate distance etc.
I have found cesium-draw the library for the VUE.
[cesium draw ](https://www.npmjs.com/package/cesium-draw)<br>
If you can work with Angular their is a lot of cesium sport in angular so you can use
[angular-cesium](https://angular-cesium.com/)
if you have found any thing else please do share I love to see.

Using Matrix Multiplication to Rotate a cube in opengl

I have some code that draws a cube. I've managed to rotate the cube using glRotatef but I need to be able to rotate the cube using only matrix multiplication. I know what matrices to use but I'm not sure how to apply them to the vertices of the cube. Is there a way to pass a vector to glVertex3f? Or a way to pass an array of vertices?
I agree completely with Drew's answer. However, I figured I'd point you in the direction of a nicely-written tutorial series that shows these concepts in action:
http://en.wikibooks.org/wiki/OpenGL_Programming
Start with the first 3 tutorials to learn shader basics, and then the 4th and 5th tutorials dive into rotation with triangles and cubes. Also, the examples use FreeGLUT, which is a framework that allows you to easily interact with your code using key presses, mouse movements, mouse presses, and more.
The OpenGL functions you're using are for immediate-mode rendering, and the vertex transformations are done within OpenGL. If you want to manually transform the vertices outside of OpenGL, you'll have to either implement matrix * vector multiplication, or use a library that does this for you.
As a side note, if you're just interested in rotation, you may find Rodrigues' rotation formula easier to implement than general matrix transformation.

How to do simple shape drawing in GTK?

I am new to Gtk and want to do simple drawing of shapes like circles and rectangles. I was looking at the gnome tutorial and the hello word example. However the curves section is undocumented. I was wondering if someone could point me in the right direction as to what should I look at, and maybe if I need to include some other supplementary library to draw?
The preferred drawing API in GTK 2 and 3 is Cairo. But if you need to develop a diagram program, with nodes that can react to events, you will need also to use a canvas, like GooCanvas.
Check out http://developer.gnome.org/gtk3/3.2/GtkDrawingArea.html about the GtkDrawingArea, plus http://developer.gnome.org/gdk/stable/gdk-Drawing-Primitives.html about Gdk-Drawing-Primitives and you are on the go.
You might also go a bit further by using this link and check out Cairo directly http://www.cairographics.org

Produce bounding box from contour locations

I am new to OpenCV so I apologize if I use incorrect terminology. I am writing a program in C that finds objects in an image (in this case red building blocks) and extracts that part of the image and displays it as a new image. I have thresholded the image to remove everything but red and used cvDilate to blur the results slightly to make the object more distinct. I then used the OpenCV Contour finding and drawing functions to locate and draw the blocks.
How can I access the contour locations stored as CvSeq* and take the upper-most and lower-most contour values from a cluster of contours (there may still be some noise from other red objects) so that I can make a bounding box around it?
Thanks
Actually, you don't have to do this manually because OpenCV provides this type of functionality for you.
Look at the cvMinAreaRect2 and cvBoundingRect. Here are their examples respectively: minarea.c (has some debugging stuff, but should give you the gist of how to use it) and generalContours_demo1.cpp (in C++, but should be easy to translate).
As a side note, I would definitely suggest using the C++ API of OpenCV as it is a bit easier to understand and has more features. Also, you spend a lot less time/code worrying about memory management since the Mat class handles that for you.
Hope that helps!

Using OpenGL Shader Language to write a simple shader

I'm going to start this off by saying that I am new to GLSL but have a decent amount of experience with OpenGL.
I currently have a project that I want to practice shaders with. I am using gluTeapot and having it rotate around the xyz axis and I want to practice writing a basic shader with it.
I currently have a sample shader and it works so I know that the OpenGL side of things is working well. All I need to do at this point is work with my vertex shader and fragment shader.
I want to start out with something simple. I want to write a shader that makes alternating stripes of red green and blue.
Here's what I know I need to do so far, but I'm not exactly sure how to actually implement it:
1) I know that I need to make constants for red, green, and blue that are of the type vec4
2) I know that I should probably just use mod(ycoord, 3.0) to determine which color belongs at a certain location
3) I know that I am going to have to figure out some way to get this pattern to rotate along with the teapot or else it will just look stupid.
I have tried looking around the internet for some good tutorials for the basics of GLSL but I haven't understood any of the ones that I have read well enough to put them to use. I also haven't been able to find any questions here that I have been able to put to use.
Any help that you can give to a newbie at writing shaders would be appreciated.
Thanks.
Try the Learning WebGL series. It'll give you examples of simple shaders and work you up to advanced topics. Everything uses standard GLSL and you can play with it in your web browser.
http://learningwebgl.com/

Resources