Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 15: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 13: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 16: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 12: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 09: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 09: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 08: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]
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (36 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (27 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!