graphics

What are the good javascript libraries for drawing shapes?

I'm wanting to create various shapes in HTML pages and am looking for a decent javascript library to simplify the task. What type of js libraries exist for drawing shapes on the web? I am familiar with Raphaël for SVG - but don't really know what else is out there for SVG or non-SVG drawing. ...

How to use GLUT/OpenGL to render to a file?

I have a program which simulates a physical system that changes over time. I want to, at predetermined intervals (say every 10 seconds) output a visualization of the state of the simulation to a file. I want to do it in such a way that it is easy to "turn the visualization off" and not output the visualization at all. I am looking at O...

Depth buffer only show blue color

I'm trying to implement Light Prepass rendering in RenderMonkey. So far, in Normal+Depth pass, it seems like Normal buffer is getting correct result, but Depth buffer only show one color. How can I check if my Depth buffer is correct or not? Workspace download link: http://www.mediafire.com/?jq3jmantyxw ...

Fastest way to calculate cubic bezier curves?

Right now I calculate it like this: double dx1 = a.RightHandle.x - a.UserPoint.x; double dy1 = a.RightHandle.y - a.UserPoint.y; double dx2 = b.LeftHandle.x - a.RightHandle.x; double dy2 = b.LeftHandle.y - a.RightHandle.y; double dx3 = b.UserPoint.x - b.LeftHandle.x; double dy3 = b.UserPoint.y - b.LeftHandle.y; ...

In the .NET framework, why are there PointF (float) and no "PointD" (double)?

Can anyone explain why, in the .NET framework, there are PointF structures (using the single-precision float type) and no "PointD" (using the double-precision double type)? Did they establish that such precision would never make sense in the System.Drawing namespace? Is there any other reason? ...

Is it possible to reuse an instance of ColorFilter?

I'd like to dynamically change color of a bitmap in an Android application. I'm using Paint.setColorFilter() to do this but I'd like to avoid creating multiple instances of eg. PorterDuffColorFilter inside the game loop. Do you know a way to acomplish this? ...

Fastest way of doing transformations (Move, Rotate, Scale)

I was looking at this vector drawing application called Creative Docs .Net . I noticed that I can have hundreds of shapes and moving, rotating and scaling do not lag at all. Given that all verticies must be modified, how do applications generally do these transformations as quickly as possible? Thanks ...

bezier path widening

Hello. I have a bezier curve B with points S, C1, C2, E, and a positive number w representing width. Is there a way of quickly computing the control points of two bezier curves B1, B2 such that the stuff between B1 and B2 is the widened path represented by B? More formally: compute the control points of good Bezier approximations to B1...

2D game algorithm to calculate a bullet's needed speed to hit target?

I have a rather simple bird's-view 2D game where tower sprites defend against incoming moving sprites by shooting a bullet at them. My question: How do I calculate the needed bullet speed for the bullet to reach its moving target, provided that the bullet will always have the same defined speed? I'm using JavaScript and have these sprit...

Poor performance of CGContextStrokePath while drawing a few lines and circles on iPhone

I need to draw a few hundred lines and circles on my view and they keep moving through a timer function, where I call [myView setNeedsDisplay] to update the view. I subclass (myView) from UIView and implement drawRect function to do the following ... -(void) drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(...

OpenGl VBO technicalities in C++

I'm a little confused as to the proper usage of VBOs in an OpenGL program. I want to create a terrain paging algorithm, using a map called from a 4096x4096 greyscale heightmap as the "whole" map. From what I've read, each vertex stored in the VBO will take up 64 bytes. The problem I have is that most sources state that a single VBO sh...

Most efficient way of implementing this?

Hi Guys, I've got a 1km square, I'm dividing it up into 100meters both on the positive and negative sides of it.. __________y__________ | | | | | | | | | |---------|---------| x | | | | | | ...

Differences between OpenGL ES iPhone games with MBX vs SGX graphics chips?

What differences have you seen when running an OpenGL ES based iPhone game on a device using an SGX chip... when the game was originally developed for a device using an MBX chip? ...

QGLWidget::renderText bounding box

Is it possible to get the bounding box of the output of QGLWidget::renderText() in logical or window coordinates? How? ...

display values in stacked lattice barchart [R]

Hi, I want to display the values of a 100% bar for each part of it. Unfortunately I don't know how to do it. The graph should be in lattice because of the legend position (I tried it with ggplot2, but you can't show the legend in one row). I'm pleased about any suggestions or ideas. Thanks, Sebastian library(lattice) data(postdoc, pac...

Generating a cubic bezier curve from rough points

I'm looking for a way to make my application produce smoother results in freehand mode. Right now it simply adds each mousemove points and makes a polygon out of this. I noticed modern vector applications produce bezier curves to make it look much smoother and im wondering how this is done? So how can I get the 4 points to do bezier inte...

Simple 2D graphics programming

I used DirectDraw in C and C++ years back to draw some simple 2D graphics. I was used to the steps of creating a surface, writing to it using pointers, flipping the back-buffer, storing sprites on off-screen surfaces, and so on. So today if I want write some 2D graphics programs in C or C++, what is the way to go? Will this same metho...

2D Graphical Editing Framework for PowerPoint or Visio style editing (.NET Prefered)?

Is there a good 2D Graphical Editing Framework for PowerPoint or Visio style editing? A .NET solution is prefered for our application. In our case, a lightweight solution is preferable to a heavyweight solution. We aren't looking for the full range of features found in PowerPoint or Visio - just the basics. ...

JfreeChart: Scroll XYBarChart Horizontally - (chart translation and navigation)

Hi all, I am trying to scroll my XYBarChart horizontally, I am following one of the JfreeChart's Demo "TranslateDemo1.java" in which the source code you can find here: http://code.google.com/p/cori-chenxx/source/browse/aliper/trunk/aliper-core/src/test/java/com/alibaba/aliper/TranslateDemo1.java?spec=svn148&r=148 The source code ...

Adding lines and labels in lattice barchart [R]

Hi, I have two questions concerning customizing a barchart in lattice. I tried to add labels to the barchart respectively edit the scale, but my code doesn't work. What I'm doing wrong? There should be some values including "%". The second question is how lines can be drawn between the top and the bottom of the plotting area behind the ...