Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Re: JOGL TextureRenderer slow? on: 2007-11-21 16:44:33
Quote
Could you try profiling it just to make sure?

I've never used a java-profiler before...
I can only say:
If I remove the call to getTexture the CPU usage is 7 times smaller.

2  Java Game APIs & Engines / JOGL Development / Re: JOGL TextureRenderer slow? on: 2007-11-21 14:55:24
Hi Martin,

sorry, but that doesn't help  Sad
I think renderer.getTexture() is the bottleneck...
3  Java Game APIs & Engines / JOGL Development / Re: JOGL TextureRenderer slow? on: 2007-11-20 17:38:10
Quote
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.  Wink . 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)); //transparent background
   g2.clearRect(0,0,100,100); //clear all
   
    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();
   
   
    //draw orthogonal quad.
   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
6  Java Game APIs & Engines / JOGL Development / Re: JOGL + Overlay + Performance Hit on: 2007-11-13 10:10:53
Hi,

I figured it out myself. The bottleneck was not "drawAll()" but the constructor of Overlay.  Roll Eyes  Roll Eyes

Bye
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();

Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (81 views)
2013-05-17 21:29:12

alaslipknot (91 views)
2013-05-16 21:24:48

gouessej (122 views)
2013-05-16 00:53:38

gouessej (114 views)
2013-05-16 00:17:58

theagentd (126 views)
2013-05-15 15:01:13

theagentd (113 views)
2013-05-15 15:00:54

StreetDoggy (158 views)
2013-05-14 15:56:26

kutucuk (180 views)
2013-05-12 17:10:36

kutucuk (180 views)
2013-05-12 15:36:09

UnluckyDevil (187 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.176 seconds with 21 queries.