Show Posts
|
|
Pages: [1]
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: JOGL TextureRenderer slow?
|
on: 2007-11-20 17:38:10
|
Just something that seemed odd to me but why are you marking the TextureRenderer dirty from (0,0) to (500,500) since the width and height of the renderer are 100 each.
That's because it's messy test code.  . But it doesn't solve the actual problem...
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / Re: JOGL TextureRenderer slow?
|
on: 2007-11-20 13:09:08
|
Hi emzic, Here is my quick test-routine which I call every frame (Imagine I'd like to create animated 2D graphics). I guess it does the same as the Overlay class (I took a look into the Overlay and TextureRenderer source to see how it works) As I noted, when I call my "render2D" 10 times in a loop the CPU usage rises to over 60%. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| TextureRenderer renderer = null;
int render2D(GL gl, GLDrawable gld) {
if (renderer == null) { renderer = new TextureRenderer(100,100,true); renderer.setSmoothing(false); } Graphics2D g2 = renderer.createGraphics();
g2.setBackground(new Color(0,0,0,0)); g2.clearRect(0,0,100,100); g2.fillRect(0,0,10,10); g2.setPaint(new Color(99,0,255)); g2.drawRect(0,0,22,22);
g2.dispose(); renderer.markDirty(0,0,500,500); Texture tex = renderer.getTexture(); tex.bind(); int x = 45; int y = 45; int w = 100; int h = 100; y = gld.getHeight()-y; gl.glBegin(GL.GL_QUADS); gl.glTexCoord2i(0,1); gl.glVertex3d(x,y-h,0f); gl.glTexCoord2i(1,1); gl.glVertex3d(x+w,y-h,0f); gl.glTexCoord2i(1,0); gl.glVertex3d(x+w,y,0f); gl.glTexCoord2i(0,0); gl.glVertex3d(x,y,0f); gl.glEnd();
return 0; } |
|
|
|
|
|
5
|
Java Game APIs & Engines / JOGL Development / JOGL TextureRenderer slow?
|
on: 2007-11-20 10:27:59
|
|
Hi,
I'm still fighting to get some Graphics2D onto my JOGL scene. I'm using TextureRenderer to create a small 100*100 texture. But then TextureRenderer.getTexture() is damn slow! If I call it only 10 times in a row, the CPU usage jumps to over 60%. I used "-Dsun.java2d.opengl=True"
What am I doing wrong? Isn't there a simple and efficient way to draw some 2D graphics?
Bye Chris
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / JOGL + Overlay + Performance Hit
|
on: 2007-11-13 09:45:15
|
Hi, I'm trying to use the Overlay class to draw some 2D grahpics over my 3D scene. Unfortunately I'm getting a CPU hit of about 30! percent, even if I only draw some simple rectangles. If I remove the "drawAll()" call everything is fine. Please see the test code below. Can someone give me a hint how to optimize it? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); Overlay ol = new Overlay(gld); Graphics2D g = ol.createGraphics();
g.setPaint(new Color(255,255,0)); g.fillRect(0,0,10,10); g.setPaint(new Color(0,255,0)); g.fillRect(10,10,40,40);
glu.gluLookAt(posx,posy,posz, posx+dirx,posy+diry,posz+dirz, 0.0,1.0,0.0); gl.glDrawArrays (GL.GL_TRIANGLES,0,numQuads); ol.markDirty(0, 0, 100, 100); ol.drawAll();
gl.glFlush(); |
|
|
|
|
|