Newbie: How to create a Pixel Unpack Buffer?

Started by Antiveganer, March 11, 2005, 09:19:58

Previous topic - Next topic

Antiveganer

I am working with my opengl book and im trying to code the examples. I tried to create a stippled Polygon with this code:
public void render(){
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
                glLoadIdentity();
                glTranslatef(0,0,-5);
                
                glEnable(GL_POLYGON_SMOOTH);
                glEnable(GL_POLYGON_STIPPLE);
               
                
                glPolygonStipple(0xAAAA);
                glBegin(GL_POLYGON);
                {
                    glVertex3f(0f,1f,0f);
                    glVertex3f(-1f,-1f,0f);
                    glVertex3f(1f,-1f,0f);
                    glVertex3f(1f,0f,0f);
                }
                glEnd();
}

But when trying to run it i get the following error in line glPolygonStipple(0xAAAA);
Exception in thread "main" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Pixel Unpack Buffer Object is disabled
	at org.lwjgl.opengl.GLBufferChecks.ensureUnpackPBOenabled(GLBufferChecks.java:98)
	at org.lwjgl.opengl.GL11.glPolygonStipple(GL11.java:1276)
	at Test.<init>(Test.java:47)
	at Test.main(Test.java:98)

Thanks for your help!
freddy[/code]
n the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
Douglas Adams

spasi

PolygonStipple requires a byte buffer, with 32x32 values. With PBO, you can also specify a pixel buffer offset, which is why a method with an int argument also exists.

Antiveganer

Well that makes sense.. im gonna try it with a bytebuffer then... thanks a lot
edit: it works perfectly
n the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
Douglas Adams