Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RenderToTexture Question  (Read 2537 times)
0 Members and 1 Guest are viewing this topic.
Offline Therion_

Senior Newbie





« Posted 2010-05-26 06:56:46 »

hello @all,

i got an strange problem with the fbo's since a short time,
it was working a long time but yesterday the code stops with an out_of_memory.
the only thing that changed was an update of java.


i dont know if my code was unstable or is there any other method?

much greetings and thanks for any help Smiley


Quote
 

import com.sun.opengl.util.FBObject;
...

   static IntBuffer fbo         = BufferUtil.newIntBuffer(1);
   static IntBuffer depth       = BufferUtil.newIntBuffer(1);
   static IntBuffer fbo_texture = BufferUtil.newIntBuffer(1);
...


static void initializeFBO(GLAutoDrawable drawable,int width, int height)
    {
   
                GL2 gl = drawable.getGL().getGL2();

                gl.glGenFramebuffers(1, FSO_ENGINE.fbo);
!->>           gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0));  << -at this point the app gets memory error!
           gl.glGenRenderbuffers(1, FSO_ENGINE.depth);

               
           gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0));
           gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, width, height);
           gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0);
           gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0));
           gl.glGenTextures(1, FSO_ENGINE.fbo_texture);
           gl.glBindTexture(GL.GL_TEXTURE_2D, FSO_ENGINE.fbo_texture.get(0));
           gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
           gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
                gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S    , GL2.GL_CLAMP);
        gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T     , GL2.GL_CLAMP);

                gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S    , GL2.GL_CLAMP_TO_EDGE);
        gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T     , GL2.GL_CLAMP_TO_EDGE);

           gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
           gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, wid,hei, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, null);
           gl.glViewport(0,0,width,height);
...
...
...
Offline lhkbob

JGO Knight


Medals: 32



« Reply #1 - Posted 2010-05-26 15:37:16 »

Question: Is it a Java OutOfMemory exception or OpenGL returning an out of memory error? I don't see how the code you've posted could have out of memory errors in Java.  Have you tried experimenting with changing the heap size to see if that solves the problem, or measuring how much of the heap is used up?

Offline Therion_

Senior Newbie





« Reply #2 - Posted 2010-05-26 19:43:27 »

here some infos:
-Djava.library.path="lib" -Xmx1024m -Xms1024m

the application break after the
gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0));
line and return with error (see below)

i am not very experienced with such error messages in java
and didnt know what to do.
i take a look at some examples,but all i found was written in c++/opengl
and that could net help me ( my code was working , but monday...)

maybe the IntBuffer could be a problem, is there anything to take care?



Quote
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glBindFramebuffer(<int> 0x8D40, <int> 0x1): GL_OUT_OF_MEMORY ( 1285 0x505),
        at javax.media.opengl.DebugGL2.checkGLGetError(DebugGL2.java:24207)
        at javax.media.opengl.DebugGL2.glBindFramebuffer(DebugGL2.java:9980)
        at org.unterhaltungsuniversum.OPEN_GL.initializeFBO(OPEN_GL.java:1125)
        at org.unterhaltungsuniversum.FSO_ENGINE.init(FSO_ENGINE.java:994)
        at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:88)
        at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:603)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:149)
        at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290)
        at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:368)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4489)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2010-05-26 21:17:12 »

What happens if you prepend this line:
1  
2  
3  
           FSO_ENGINE.fbo.rewind(); // <---
           gl.glGenFramebuffers(1, FSO_ENGINE.fbo);
           gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0));


is the position of your buffer is non-zero, JOGL might (or might not?) use that offset, to write the handle.

if you bind the handle at index zero (fbo.get(0)) it might refer to another handle, or some random region in CPU-memory where it tries to read the width/height, and at a random memory location, that might contain any (bogus) value, tripping your driver.

just guessing...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Therion_

Senior Newbie





« Reply #4 - Posted 2010-05-27 05:46:16 »

the rewind sounds good, but didnt work..same error stays.  Cry

i also try to use ...  fbo.reset();  , nothing happend

memory is more that enough...i reduce the number of used textures to
minimum(2 x 256*256) ..nothing happend.

and i got no memory killer arrays in the engine...all very simple

but i am very sure that the
    static IntBuffer fbo              = BufferUtil.newIntBuffer(1);
    static IntBuffer depth          = BufferUtil.newIntBuffer(1);
    static IntBuffer fbo_texture = BufferUtil.newIntBuffer(1);
must be the problem...

Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2010-05-27 05:57:57 »

You aren't running out of Java memory, then you'd have a OutOfMemoryError, but you're seeing the driver reporting a GL_OUT_OF_MEMORY state, which indicates a lack of vRAM.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Therion_

Senior Newbie





« Reply #6 - Posted 2010-05-27 06:42:10 »

omg...

i found what the app disturbed.
-the nvidia desktop manager software eats all vram!
(after deaktivating this program all works fine again
(i use 2 screen ,and got no need of any extra screen manager... must be activated in any way)

thanks for all answers!  Cheesy

(i program on older geforce go7300 notebook... on other hardware the problem didnt exist)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (28 views)
2014-11-22 12:13:56

xFryIx (70 views)
2014-11-13 12:34:49

digdugdiggy (49 views)
2014-11-12 21:11:50

digdugdiggy (43 views)
2014-11-12 21:10:15

digdugdiggy (37 views)
2014-11-12 21:09:33

kovacsa (61 views)
2014-11-07 19:57:14

TehJavaDev (65 views)
2014-11-03 22:04:50

BurntPizza (63 views)
2014-11-03 18:54:52

moogie (79 views)
2014-11-03 06:22:04

CopyableCougar4 (78 views)
2014-11-01 23:36:41
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!