GL_OUT_OF_MEMORY (1285)

Started by biggeruniverse, April 24, 2005, 01:27:29

Previous topic - Next topic

biggeruniverse

I'm attempting to use vertex buffer objects, and get the following result:

org.lwjgl.opengl.OpenGLException: Out of memory (1285)
	at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
	at org.lwjgl.opengl.Display.update(Display.java:515)


The draw code looks like this:

GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
            
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vbo.getVboId());
            
GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
            
GL12.glDrawRangeElements(type, vbo.getStart(), vbo.getEnd(), vbo.getIndices());
           
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);


And generation looks like this:

IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
	        
	        ARBVertexBufferObject.glGenBuffersARB(buf);
			id = buf.get(0);

			IntBuffer indices = BufferUtils.createIntBuffer(tris.length*3);
			int i=0;
			
		    for(int j=0;j<tris.length;j++,i+=3) {
		        buffer.put(m.getVertex(tris[j].getA()).getCoords().x);
			    buffer.put(m.getVertex(tris[j].getA()).getCoords().y);
			    buffer.put(m.getVertex(tris[j].getA()).getCoords().z);
			    buffer.put(m.getVertex(tris[j].getB()).getCoords().x);
			    buffer.put(m.getVertex(tris[j].getB()).getCoords().y);
			    buffer.put(m.getVertex(tris[j].getB()).getCoords().z);
			    buffer.put(m.getVertex(tris[j].getC()).getCoords().x);
			    buffer.put(m.getVertex(tris[j].getC()).getCoords().y);
			    buffer.put(m.getVertex(tris[j].getC()).getCoords().z);
			    
			    indices.put(i);
			    indices.put(i+1);
			    indices.put(i+2);
		    }
		    
		    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, id);
			ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);


No matter what I've tried, the result is always the same (glDrawArrays, glDrawElements, etc.)

I realize it's an old card, but it should have sufficient RAM for say, 3 triangles. Ideas?

OS: Linux
Card: Riva TNT2/AGP/3DNOW! (32mb)
NVIDIA Driver set: 71.67

biggeruniverse

Ha. Well, before anyone beats their head on this one, buffer.rewind() fixes it (miss on my part); but now my problem is different: the objects disappear when using VBOs, but appear fine in immediate mode. Traslation/rotation is performed either way, prior to any rendering.

biggeruniverse

You know, sometimes I think I should look at things after I sleep. Please disregard.