graphics

Most efficient way to draw multiple identical objects?

I would like to make a game out of many cubes and am planning on putting it on mobile platforms and also on the web using webgl. My problem is when I make a drawelements call per cube I take a hit on the frame rate. Is there a way I can make a single draw call to opengl es to draw them? The only difference between the cubes would be pos...

WinForms Graphics PictureBox with dynamic width

Hello. I'm making a winform .NET app. It must show a graphic in bars format. I'm using a picturebox because it's the only way I know how to do it (if someone knows a better way, please tell me). I'm adding dynamically the lines (the bars of the graphic) with this code: int currentX = this.lineAmmount * (lineWidth + lineMargin); pictur...

Drawing with Graphics class in C#

Hi, I would like to draw in C# with the mouse, like if the mouse were a pen. I am trying with Graphics class, using DrawLines method receiving an array of points as parameter. Do you think this is the better option, or do yo know if is there another easy way to do it? Thanks in advance Regards. ...

Converting sample iPhone Code to iPad

Hello - I am pretty much clueless when it comes to graphics so I am trying to make a simple drawing view in my iPad using this tutorial as reference: http://www.ipodtouchfans.com/forums/showthread.php?t=132024 The problem I am having is that the points that are drawn on the screen are a couple inches off from where the finger is actu...

How to optimize my JOGL app?

I'm using OpenGL with JOGL. My project is getting sort of slow. I'm new to OpenGL. What are some of the best ways to optimize it? What are some good tools to profile? (I'm using Eclipse.) I recently switched from using one static Texture object for a whole bunch of models, to each one having its own Texture object. This appeared to slow...

Confused about Frustrum Culling

I'm new to OpenGL. I'm using it with JOGL. I'm reading about frustrum culling: http://www.lighthouse3d.com/opengl/viewfrustum/ http://www.crownandcutlass.com/features/technicaldetails/frustum.html I'm not sure exactly what it's supposed to do. Doesn't OpenGL cull off-screen objects automatically? (Is this culling significantly slower...

I'm looking for specific matrices to plug into a convolution matrix

Assuming I already have a working convolution matrix algorithm in place, I'm looking for practical examples of general matrices that are useful for image processing in particular. The canonical examples you'll find everywhere are non-gaussian box blur: 1 1 1 1 1 1 1 1 1 Image sharpening: 0 -1 0 -1 5 -1 0 -1 0 Edge detec...

MeasureString and DrawString difference

Hello, why do i have to increase MeasureString() result width by 21% size.Width = size.Width * 1.21f; to evade Word Wrap in DrawString()? I need a solution to get the exact result. Same font, same stringformat, same text used in both functions. From answer by OP: SizeF size = graphics.MeasureString(element.Currency, Currencyfont...

WinForms Chart Control autoscroll

Hello. I've got a bar's graphic in a chart control in my app. I've set the properties as this code shows: Chart1.ChartAreas("ChartArea1").AxisX.ScrollBar.Enabled = True Chart1.ChartAreas("ChartArea1").AxisX.IsLabelAutoFit = True Chart1.ChartAreas("ChartArea1").AxisX.ScaleView.Size = 40 I did that becaus I wanted to fix the columns wi...

Do I need to restore the Graphics state after painting in my OnPaint override (for a .NET Control)

Consider the following overriden OnPaint method for a .NET Control: protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.RotateTransform(180); // lots of drawing code } Is it a problem that I do not restore the state of the e.Graphics object when I am finished? In Java this is often done by making...

.Net DrawString font reference changes after calling, is this a potential problem

Given the following code. Is there any potential for the first DrawString method to draw in Arial rather than Times New Roman? protected override void OnPaint(PaintEventArgs pe) { Font f = new Font("Times New Roman", this.TextSize); pe.Graphics.DrawString("Test 1", f, Brushes.Black, loc); f = new Font("Arial", this.TextSiz...

Python 3: Converting image to grayscale

I'm trying to do an exercise in John Zelle's "Python Programming: An Introduction to Computer Science". I downloaded a special graphics package for his book (graphics.py, which is on the linked website). The question reads as follows: Write a program that converts a color image to grayscale. The user supplies the name of a file containi...

Is there a need to code a new 3D engine?

Coding a new 3D engine is fascinating but I there are so many out there. Is it sane for a programmer to start a new one? Are there industry sections in need? ...

Difficulty with Text in JOGL

I'm trying to display text in my OpenGL / JOGL app. Here is some of the code: private void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); GLUgl2 glu = new GLUgl2(); float[] rgba = new float[4]; backgroundColor.getRGBComponents(rgba); gl.glClearColor(rgba[0], rgba[1], rgba[2], 1); gl.glCle...

Sound with JOGL?

I have a JOGL app, and I'd like to programmatically play audio files. Is this possible? ...

OpenGL: How to make text appear at the same pixels regardless of camera orientation?

I have text that I am successfully rendering in OpenGL: GLUT glut = new GLUT(); gl.glRasterPos2d(10, 10); glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "We're going to the moon!"); I would like this text to appear in the same location on the user's screen (occupying the same pixels) regardless of camera orientation. How ...

OpenGL: Set text color?

I'm successfully displaying text in OpenGL: GLUT glut = new GLUT(); gl.glWindowPos2d(10, 20); glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, DISPLAYED_TEXT); However, I'm not sure how to set the color. (I can see the color changing as I move the camera around, looking at different models, but I'm not sure what causes it t...

Game engine or graphics library?

Should I use a game engine or a graphics library? I was just thinking of making a simple game to start out with, but what about when you get to higher-end stuff and high poly models? Which would be faster? Also, should I choose Xith3D or JMonkeyEngine? Or if I were to go with a graphics library should I go with JOGL, LWJGL, or the new J...

Searching for 3d graphics library preferably java based to solve my problems

I need a 3d graphics library that is free and Java based for offline ( batch mode) 3d graphics processing ( not gaming application). I need to write programs or scripts that would perform a variety of operations working with the higher level scene graph of the 3d model. Note it must work with well known 3d formats such as 3ds Max (.max f...

drawing part of a bitmap on an Android canvas

How can you blit a non-rectangular (e.g. oval) part of a bitmap into a canvas on Android? Consider how you'd blit a rectangular part of a bitmap: canvas.DrawBitmap(src,src_rect,dest_rect,paint). Sadly there is no corresponding methods for non-rectangular regions. Four approaches present themselves (maybe you know a fifth?): copy the...