graphics

Changing size of points in R

I would like to make a scatter plot using R base graphics, though I can use ggplot if it is necesary. I have a data frame containing the x and y coordinates, and also two other covariates, call them a and b. I would like the size of each point to vary with a (high values of a -> larger points) and the brightness/solidity of each point ...

How to get the vertices of a polygon described by planes

This is a repost of a question that went unanswered basically I am trying to model a map that has the following format: Each brush defines a solid region. Brushes define this region as the intersection of four or more planes. Each plane is defined by three noncolinear points. These points must go in a clockwise orientation: 1--2-----...

How to implement an eraser tool in a simple drawing app?

Hello! I have a prototype of a simple drawing application. When the user drags a finger across the screen, I record the points along the way and draw a series of lines between them. In other words, a drawing is a list of “paths” and each path is a list of points to connect. This is easy, it works and it’s efficient. The problem is I’d l...

Understanding the behavior of IDirect3DDevice9::Present when it blocks for vsync

I'm developing a scientific application that has to estimate (as best as possible) the time difference between an object getting drawn in the video back buffer and the point at which that object actually becomes visible on the screen. In other words, how DirectX on Windows XP+ deals with monitor's vertical refresh cycle. I'll start by s...

View a WPF UserControl on another computer over LAN

I have a UserControl (inherits Canvas) on a WPF Window that is reading and displaying some realtime imagery, and overlaying shapes and text atop the image. I'm looking for ways to clone this Canvas onto another WPF Window on another computer. The host computer has a bunch of controls that affect the programs operation, I want the client...

Graphics: .obj files and materials/textures

I am new to OpenGL / JOGL. I am able to hardcore a texture onto a polygon, and I am correctly drawing polygons specified in .obj files. I now want to draw the materials/textures specified in those .obj files, but I'm not quite sure what to do. For example, I downloaded this gazebo. The download contains a single .obj file. From that fil...

Organization chart algorithm...

Does anyone have a line on an algorithm to place boxes in an organizational chart? Any language is fine. ...

How can I animate a lot of text behind a graphic?

The page would be white with the shape of the Taj Majal punched out (i.e., a mask) with the letters scrolling from right to left on a layer below the mask. See a visual comp here. Each line of text should scroll independently, and loop around when it reaches the left edge. I've looked at SVG, HTML5/canvas, and jQuery marquee. Is one of...

How would you calculate the point size of a font necessary to best fit a predefined area?

I have an interesting problem. I'm almost there but am curious how others would tackle it. I want to display some multi-line text in a predefined area. I don't know what the text will be or how big the area will be so the function would have to be written generically. You can assume a standard font is always used but the point size is...

OpenGL: Create a sky box?

I'm new to OpenGL. I'm using JOGL. I would like to create a sky for my world that I can texture with clouds or stars. I'm not sure what the best way to do this is. My first instinct is to make a really big sphere with quadric orientation GLU_INSIDE, and texture that. Is there a better way? ...

OpenGL: Am I texturing this wrong?

I am new to OpenGL. I am using JOGL. I downloaded this model. It has a bunch of textures. I'm trying to apply "truck_color-blue.jpg" here, but I'm not sure I'm doing it right. This is what I'm seeing: Essentially, what I am doing is recording all the vt, v, and vn entries, then using the f lines to index into them. This is the code t...

Training sessions: Android graphics

Hello there, Can anyone please recommend a training session/course for Android graphics API/OpenGL ES? Thank you! ...

Can someone describe the algorithm used by Ken Silverman's Voxlap engine?

From what I gathered he used sparse voxel octrees and raycasting. It doesn't seem like he used opengl or direct3d and when I look at the game Voxelstein it appears that miniature cubes are actually being drawn instead of just a bunch of 2d square. Which caught me off guard I'm not sure how he is doing that without opengl or direct3d. ...

OpenGL: Materials with Display Lists?

I am using JOGL with OpenGL. I'm drawing everything through display lists. I'm trying to figure out how to specify materials. I've been looking at this documentation. The following looks pretty straightforward: glPushMatrix(); glTranslatef (-1.25, 3.0, 0.0); glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); glMaterialfv(GL_FRONT,...

What is the most efficient way to draw voxels (cubes) in opengl?

I would like to draw voxels by using opengl but it doesn't seem like it is supported. I made a cube drawing function that had 24 vertices (4 vertices per face) but it drops the frame rate when you draw 2500 cubes. I was hoping there was a better way. Ideally I would just like to send a position, edge size, and color to the graphics ca...

How can I change the edge line color when using the 'fill' function in MATLAB?

I'm writing code in which I use MATLAB's fill command to plot 2D shapes. I can specify the fill color of the shape. However, the border line color is always black. I want the border line color the same as the fill color. How can I also specify the border line color? ...

How to draw multiple objects using a VBO and a single OpenGL drawelements call?

I've read that it is possible to draw multiple objects using a vbo and using single drawelements call. I haven't found any examples of this. Right now I'm making a drawelements call per cube drawn which is killing my frame rate since I'm making the entire game out of them. Any help is appreciated, especially example code. ...

How to apply a normal map in OpenGL?

I'm learning to use normal maps (per pixel lighting?) in 2D graphics with OpenGL. New to normal mapping, I managed to wrap my head around the Sobel operator and the generation of normal maps (mostly thanks to this), that is creating a (2D) array of normals from a (2D) array of pixel data. (Most of the tutorials and forum threads that I...

OpenGL: Turn off all lighting except what I specify?

I'm new to OpenGL/JOGL. I'm experimenting with lighting: gl.glEnable(GL2.GL_LIGHT1); gl.glEnable(GL2.GL_LIGHTING); When I disable the first line, all the objects in my scene get somewhat dark, but they still have some light. Where else could that light be coming from? (This is the only light source I have.) Is there some defau...

What does Canvas.getClipBounds() return if the canvas is rotated?

I have a simple question which keeps me thinking for a few hours now. Assume a canvas which is rotated by a specific (known) degree. I want to get the screen coordinates of a bitmap I have drawn on the rotated canvas. To achieve this, I need the canvas' clip bounds. This would be no problem for a non-rotated canvas. But it keeps giving ...