graphics

Dealing with drawables for various screens sizes.

I have observed from the HDPI, MDPI and LDPI icons from a new Android project, they are in the ratio of 6:4:3 (72:48:36). So would it be a good idea to scale my other drawables in the same ratio? If not what is the best way to scale drawable resources for an application for deployment? ...

Structure of a HLSL 4 File

Hi, I'm new to HLSL programming and although there are many nice hello-world type examples on the internet, it's difficult to know how I should be structuring my HLSL files. For example I have a HLSL file called DrawImage which is just used for drawing 2D billboard-type images on-screen: Texture2D image; SamplerState Sampler { Fi...

An UV mapping algorithm to maximize texel density and consistency?

I'm looking for a way to automatically map a 3D mesh's polygons onto UV space such that texel density is maximized and kept as consistent as possible between polygons. Does an algorithm exist that will provide better results in this respect than standard projections such as planar, box, cylindrical, and spherical? ...

Projecting a texture in OpenGL

FIXED by setting near clipping plane to 1, rather than 0 (not sure why it was like that to start with). See the question for skeleton code, and Adrian's answer for how and why this works. I have a few different camera positions, and my scene consists of a single quad. The quad is such that it projects exactly onto the viewport/window i...

R: Add extra spacing between a subset of plots

I'm trying to output 6 figures into one image, in a 3x2 layout. I'd like to place extra space between the top row and the bottom two rows. Is this possible using R? I've looked through the documentation for par and plot and can't seem to find an appropriate option. Here's some example code: a = rnorm(100,100,10) b = rnorm(100,100,10) ...

3D Graphics: software for visualizing 3D vectors?

I'm trying to teach myself about 3D graphics, but I'm having trouble visualizing the 3D vectors involved. Is there any good software that I can use to visualize 3D vectors? For example, right now I'm learning about camera transformations, and it would be nice if I could easily plot the right/up/look/eye vectors. I've tried Grapher.app...

how to perform mouse action for following program

import java.awt.* ; import java.awt.event.* ; import javax.swing.* ; import java.io.*; import java.awt.image.*; /** * Class : Constants * Developed By : ARC Pvt Ltd Bengaluru * Date: 10/08/2010 * */ class Constants extends JFrame{ /*----Display Resolution-----------*/ final double adjx = 1.25; // final double adjy = 1.25;...

What Qt widgets to use to draw a "game-of-life"-like application ?

For an experiment, I'd like to create a simple graphical application. My goal isn't complex: I just need to draw single pixels or lines of different colors, and refresh the view regularly. Something like Conway's Game of Life. I'm used to work with Qt but never for this kind of task. What widgets/objects should I use to get started ? ...

Generating a list of colors, blue through red, 0% through 100%.

I want to create a list of colors, red-yellow-green-blue, and blend into each other across a span of 100. Anyone have experience in this sort of thing? Edit: Well, RGB actually. Any language will do. I just need the algorithm. ...

Mac vs other OSes in terms of screen quality

Can someone tell me why Mac has a better-looking screen compared to other OSes? I mainly use Windows and sometimes use Linux, but I have noticed that the pixel quality in Mac is noticably better - bright, crisp images. Is it an aspect of their monitor or graphics API? If it is just the monitor, I could try to find a better one for my com...

OpenGL glTexParameter

Hey guys I just had a simple question. Does glTexParamter act on all textures or just the texture that is currently bound So like if I call this at the texture load: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); And this on another texture load: glTexParame...

c++ - most simple type of graphic application in visual studio

hello! Whats the most simple way (without much fancy stuff and no big setup overhead) to create a c++ project with visual studio where i can create some graphical debug output? (mainly drawing some lines, circles and triangles in a window. doesn't have to be performant or look pretty) thanks! ...

Obtaining minimum and maximum rendered UV values (Direct3D)

I need to calculate the minimum and maximum UV values assigned to the pixels produced when a given object is drawn onscreen from a certain perspective. For example, if I have a UV-mapped cube but only the front face is visible, min(UV) and max(UV) should be set to the minimum and maximum UV coordinates assigned to the pixels of the visib...

blend two images on a javascript canvas

How do you blend two arrays of pixel data to create one image? with the option of using different blending modes? ...

Background image for wrap_content

Hello, I created a custom background image and wanted to use it as the background for a layout that has height of wrap_content. However, the total height of the contents of within that layout are much less than the height of the background image. When I set it as the background in XML via android:background="@drawable/image", I notice...

Why don't tfVerticalCenter and tfBottom work as expected in TCanvas.TextRect?

Consider the following code: procedure TForm1.PaintBox1Paint(Sender: TObject); var vRect : TRect; vFormat : TTextFormat; vStr : string; begin vStr := 'This is some text'; vRect := rect(10,10,50,130); vFormat := [tfCenter,tfVerticalCenter,tfWordBreak]; PaintBox1.Canvas.Rectangle(vRect); PaintBox1.Canvas.TextRect(vRect,vSt...

Measuring text height to be drawn on Canvas ( Android )

Any straight forward way to measure the height of text? The way I am doing it now is by using Paint's measureText() to get the width, then by trial and error finding a value to get an approximate height. I've also been messing around with FontMetrics, but all these seem like approximate methods that suck. I am trying to scale things for...

Has a Cloth Simulation ever been done in WPF or Silverlight?

I'm trying to find out if any sample Cloth simulation exists with code in WPF or Silverlight. So far this is what I've found: It's been done in DirectX and then used as an ImageBrush in WPF, but I mean without a DirectX and without a C++ dependency. It's been done in Flash and even Javascript so it's definitely possible performance wi...

canvas - layer small image on larger background image, merge to single canvas pixel data

How do I merge a smaller image on top of a larger background image on one canvas. The smaller image will move around. So I will need to keep reference of the original background pixel data, so that the each frame the canvas can be redrawn, with the overlay in its new position. BgImage: 1280 x 400, overlayImage: 320 x 400, overlayOffsetX...

C# Graphics object

Hello, Question: How to check if Graphics object is usable. My Problem: I create Graphics object from form and give it to "object X" for drawing, when form closes and "object X" tries to draw into Graphics object, GDI+ error occurs 0x80004005. So i need to check if Graphics is drawable only having that Graphics object. Any ideas? ...