graphics

OpenGL: draw line between two elements

廉价感情. 提交于 2019-12-22 09:08:26
问题 I need to draw a line between two meshes I've created. Each mesh is associated with a different model matrix. I've been thinking on how to do this and I thought of this: glMatrixMode(GL_MODELVIEW); glLoadMatrixf(first_object_model_matrix); glBegin(GL_LINES); glVertex3f(0, 0, 0); // object coord glMatrixMode(GL_MODELVIEW); glLoadMatrixf(first_object_model_matrix); glVertex3f(0, 0, 0); // ending point of the line glEnd( ); But the problem is that I can't call glMatrixMode and glLoadMatrixf

Draw cubic bezier curves in Actionscript?

爷,独闯天下 提交于 2019-12-22 08:05:26
问题 What's the best way to draw cubic bezier curves programmatically in AS3? The Graphics class only seems to support quadratic curves. :( I want to be able to do something like: var startPoint:Point = new Point(0, 0); var endPoint:Point = new Point(5, 5); var control1:Point = new Point(5, 0); var control2:Point = new Point(0, 5); var myBezier:Sprite = getBezier(startPoint, control1, control2, endPoint); For a performance target, I'm planning on having ~50 of these on the stage at once. 回答1: Note

Modifying the kerning in System.Drawing.Graphics.DrawString()

倾然丶 夕夏残阳落幕 提交于 2019-12-22 07:56:21
问题 I'm rendering text onto an image using the System.Drawing.Graphics class, and the DrawString() method. I need to generate the text for this image in a very specific way so that it exactly - pixel for pixel - matches an existing image. The problem is that the text generated by DrawString() has a different kerning to the text in the existing image (my best guess is approximately 0.5 - 1 pixel per letter). Can anyone tell me if it's possible to modify the kerning while using this namespace and

How can I improve performance of Direct3D when I'm writing to a single vertex buffer thousands of times per frame?

早过忘川 提交于 2019-12-22 06:09:46
问题 I am trying to write an OpenGL wrapper that will allow me to use all of my existing graphics code (written for OpenGL) and will route the OpenGL calls to Direct3D equivalents. This has worked surprisingly well so far, except performance is turning out to be quite a problem. Now, I admit I am most likely using D3D in a way it was never designed. I am updating a single vertex buffer thousands of times per render loop. Every time I draw a "sprite" I send 4 vertices to the GPU with texture

How can I improve performance of Direct3D when I'm writing to a single vertex buffer thousands of times per frame?

Deadly 提交于 2019-12-22 06:09:01
问题 I am trying to write an OpenGL wrapper that will allow me to use all of my existing graphics code (written for OpenGL) and will route the OpenGL calls to Direct3D equivalents. This has worked surprisingly well so far, except performance is turning out to be quite a problem. Now, I admit I am most likely using D3D in a way it was never designed. I am updating a single vertex buffer thousands of times per render loop. Every time I draw a "sprite" I send 4 vertices to the GPU with texture

ImageMagick Reflection

走远了吗. 提交于 2019-12-22 05:59:15
问题 Brief: convert ( -size 585x128 gradient: ) NewImage.png How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command. Details: I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do here but the solution isn't exactly

Overall Title for Plotting Window

拟墨画扇 提交于 2019-12-22 05:35:52
问题 If I create a plotting window in R with m rows and n columns, how can I give the "overall" graphic a main title? For example, I might have three scatterplots showing the relationship between GPA and SAT score for 3 different schools. How could I give one master title to all three plots, such as, "SAT score vs. GPA for 3 schools in CA"? 回答1: The most obvious methods that come to my mind are to use either Lattice or ggplot2. Here's an example using lattice: library(lattice) depthgroup<-equal

Java create anaglyph (red/blue image)

六月ゝ 毕业季﹏ 提交于 2019-12-22 05:28:10
问题 I'm writing a Java game engine (http://victoryengine.org) and I've been experimenting with generating "3d" images with depth that you can see with those red/blue glasses. I'm using Java2D for graphics. I've created something that works, but is very slow (by manually copying pixel values and stuff like that). What I need to is take two BufferedImages (one for the left eye, one for the right) and combine them into one (either another buffer or directly to screen). For one I just want the red

Reproducible crash using Graphics.DrawArc

浪子不回头ぞ 提交于 2019-12-22 05:20:33
问题 Our software renders technical drawings. One particular drawing made the application crash every time with an OutOfMemoryException . Upon investigation, nothing seemed out of the ordinary; the app didn't request a lot of memory, didn't use a lot of handles. I tried catching the exception and the app finished the drawing without throwing another one. In fact, there was always only the one OutOfMemoryException , and it was always the same graphics primitive that caused it. The following code is

How to avoid seams between filled areas in canvas?

自闭症网瘾萝莉.ら 提交于 2019-12-22 05:06:07
问题 When I fill adjacent areas in HTML5 Canvas or similar systems like Quartz or GDI+, I see a light colored seam on the shared edge. Here's an example, (code below): I think I understand what's going on but don't have a fix. Each edge is anti-aliased against white, so instead of a mix of orange and blue you get a mix of orange, blue and white. Essentially the same question has been asked before but with less discussion and no good answer. Some work-arounds that involve drawing the first shape a