graphics

Displaying pixmap with glDrawPixels

I've written a small example program using OpenGL and GLUT to display a 2-by-2 grid of four colored squares using the glDrawPixels function. Unfortunately, I've found that: The colors in the grid are not being displayed properly; and When the glPixelZoom function is passed negative arguments to rotate the pixmap, nothing is displayed...

How do I draw a vermiculated line in Java?

I know how to draw straight lines but could I draw a line which http://img163.imageshack.us/img163/2320/path3003.png (around a straight line i.e.)? Excuse me, I do not speak English very well to describe this more detailed ;-) Edit: Hey sorry for my late answer - you are right, it should be something like a sine wave which "vericulates...

How to draw a tree structure? (A two-dimensional space allocation tree recursion algorithm?)

I have an arbitrary tree structure of nodes. I want to draw this tree to provide users a visual representation. I need to recurse over the tree and for each node add a graphic item to a list, and then just draw the list of items once tree recursion has finished. The recursion and drawing of items is of course trivial - what's a bit more ...

Creating a "fractional" bezier spline?

Hi. I have a 4-control-point bezier curve that represents some timing stuff. The first control is fixed at (0, 0) and the last control is fixed at (1, 1). The two points in between define a bezier curve that specifies how I get from 0 to 1. Now I need to create a second curve, based off the first one. This second curve also needs to go...

how to make the graphicsline as a selectable object

I want to create an application which the user is able to manipulate the line he draw. Something like Deleting the line or Selecting it. How should I do that? Thanks in advance I managed to do it using a hard coded rectangle. But I don't still have an idea how to do it using the drawLine() Can I use drawPath to do the hit test? Here...

Release Direct3D resources left behind by forcefully terminated application

I'm working on a Direct3D application and I sometimes need to terminate the application forcefully via the debugger. After the application has been terminated in this way a couple of times, Direct3D reports an "Out of video memory" error when attempting to create a new device. Presently I am working around this by switching my display re...

how to perform mouse on click action using threads

/* main- frame */ import java.awt.* ; import java.awt.event.* ; import javax.swing.* ; public class Mainframe { public Mainframe() { // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub SimpleThread ST = new SimpleThread(); ST.sta...

selection in a lot of polylines with QGraphicsView doesn't work fine

In Qt, there is no "QGraphicsPolylineItem", so I have to implement it form QGraphicsItem. I reimplement 'paint' and 'boundingRect' functions.In 'paint()' function, I just simply draw all lines in the polyline. It's OK without any user's interaction. For selection and movable function, I reimplement the 'QPainterPath* shape()' functio...

How to enable depth testing for the GL_SELECT buffer?

I am using the GL selection buffer to implement mouse picking. Unfortunately, OpenGL is returning hits in the selection buffer even for objects that are entirely occluded. For example, if there is a man hidden behind a wall, the selection buffer will include a hit record for the man even though he is not visible. Selection is implemente...

Does it matter if you turn off the monitor while timing graphics code?

I'm fairly certain that it shouldn't matter since the graphics card is still executing the commands given by the CPU and sending the framebuffer to a monitor that is simply not listening. However, I'm not sure if the graphics card doesn't detect this. ...

Is kCGImageAlphaNone faster for bitmap drawing on the iPhone

Is using kCGImageAlphaNone any faster or slower than using kCGImageAlphaPremultipliedFirst as the color format when using CGImageCreate() for fast animation frame rendering from bitmaps. Does double-buffering the bitmaps used between alternating frames help with load-on-write memory paging performance? ...

Image Pixel Array without first drawing into main Canvas?

Do you have to first draw any source images into the canvas before you can obtain the pixel array data? or is there a better way? such as having a second hidden canvas? I am using several images that I will mash together, and draw into the main canvas. What is the best way to obtain to say backgroundData, objectsData, effectsData, from ...

putImageData / Canvas - How do I dump the pixel array in here?

How do I redraw the pixel array after I after I have previously used getImageData? The way that I thought made sense gives me the error: An invalid or illegal string was specified" code: "12 function makeImage(canvasId, background, object) { var canvas = document.getElementById(canvasId); var ctx = canvas.getContext('2d'); ...

Android: how to make a "pie Chart" with touchable wedges And the whole thing can rotate..

hey Guys, well, the title says it all: I have need to make a sort of "Pie Chart"-style circular display. the wedges of the chart have to be touchable, and the whole circle has to be able to spin 360deg.. I'm still an android noob, but I'm guessing that I can't do this with a Layout.. right? preferably, the wedges would be image ...

Simulating Ocean Water, need to compute complicated values.

Simulating Ocean Water: http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf I'm trying to simulate ocean and I need your help. Please be patient, I'm newbie to computer graphics but I know basics of physics and mathematics. As you can see I need to compute the formula: k is a vector, x is a coordinate (so I suggest that...

Vertex shading and calculating lighting vector effect

Given a triangle vertex defined with three 3D points, how do you calculate the angle between it and a given point. class Point3D { double x, y, z; } class Vertex { Point3D P1, P2, P3; } Point3D LightPoint; Light point in Red. Blue points - triangle with the surface normal shown. I need to calculate the surface normal, an...

BIG header: one jpg or several png?

I've read some of posts here about png/jpg/gif but still I'm quite confused.. I've got a big header on my website : width:850px height:380px weight:108kb And it's jpg. A woman + gradient + some layers on top and behing her.. Do you think 108kb it's too much? I was thinking about cut it to png pieces..Would that be a bad idea? What's y...

Is it possible to define two-different color for dashed stroke like selection box in Photoshop?

Currently, I can create polygon-based selection box that has only one color on dashed stroke like the following photo. In the other hand, all photo editors has selection box like the following photo. Is it possible to do this in WPF 4.0 without use double border in same place (two polygon objects place in the same location with dif...

Calculate the bounding box of a GDI+ drawing for bitmap export

I have a .NET Windows.Forms diagram editor that can export its diagrams as bitmaps. It also comes with a command line utility that just converts diagrams to bitmap images. I don't want to scale the diagram to a given bitmap size; instead, I want to size the bitmap based on the diagram's bounding box. I can easily determine it after dra...

($VersionNumber < 6) Cropping an exported image in Mathematica

http://i51.tinypic.com/15wcw2d.jpg This is an animation I made using Mathematica. As can be seen by highlighting the image, the margins at both the left and right sides are too wide. I don't want to have to submit the image to another program just for the cropping, so what do I do to eliminate the whitespace? Looking at the documentati...