I commented that out, because it's invalid OpenGL (those constants don't exist). Seems like KGL accepts this, although it shouldn't..111 wrote:aside from missing texture filtering - yes.bogglez wrote:Is this more like what you expected?
The correct way to specify the texture filter would be:
Code: Select all
texture = glTextureLoadPVR("/rd/crate.pvr", 0, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); texture = glTextureLoadPVR("/rd/ground.pvr", 0, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Yeah, something seems to be weird about the clipping code, still.("lvl.obj" is still rendered incorrectly though, no clipping issues, it is just does not look the way it should)
Here is the code to get the result in the binary. Basically I enabled near z clipping and switched to vertex arrays.
1. I think you tried to replicate the PVR's texture filtering constants in OpenGL. You really shouldn't do this, as it defeats the purpose of a cross-platform graphics library.
2. I was not able to change the face culling in KGL, so I would always see the inside of the box. In my libgl15 this worked fine.
3. I don't have support for clipping in libgl15, so I couldn't compare that, sadly. I think you're only clipping against the near plane, because the PVR does the horizontal clipping by fragment. Maybe you need to clip against the other planes as well? Haven't put much thought into it. Also, have you tested the algorithm with large polygons or just small polygons?
3. enabling near z clipping didn't work for me with glBegin, but maybe I did something wrong. worked with vertex arrays.
4. I think near z clipping should really be on by default. turning it off is a performance optimization that can only be used when the user checks the required conditions.
5. Your example code uses invalid OpenGL constants. Maybe you want to use the gl.h I have in my library which uses only standard constants, and remove the invalid ones from your code.