RedLikeRoses wrote: ↑Tue Jul 09, 2019 1:34 pm
Take this example of functioning mipmaps:
Code: Select all
//pWidth, pHeight, are power of 2 width and height.
inline void bindMipMaps(Texture* mipmap) {
sceGuTexMode(colorMode, 2, 0, swizzled); //ColorMode and Swizzled are of the current texture
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); //Doesn't necessarily need to be set. Modulation is useful if you know how to use it.
sceGuTexOffset(0.0f, 0.0f); //No offsets
sceGuTexWrap(GU_CLAMP, GU_CLAMP); //Doesn't matter
sceGuTexLevelMode(GU_TEXTURE_AUTO, 0.0f); //This should work
sceGuTexFilter(GU_NEAREST_MIPMAP_NEAREST, GU_NEAREST); //Set your filters according to what you want
//The mipmaps are for the long range, as doing only 0 and 1 would make them appear too close and result in weird experiences.
sceGuTexImage(0, pWidth, pHeight, pWidth, data);
sceGuTexImage(1, pWidth, pHeight, pWidth, data);
sceGuTexImage(2, mipmap->pWidth, mipmap->pHeight, mipmap->pWidth, mipmap->data);
}
Thank you very much for answering.
Unfortunately, it didn't work, it just shows sceGuTexImage 0. I'm starting to think this is broken in the sdk
, or I'm missing something important.
I made a very simple test that draws a square with a texture, and checked texture data is loaded:
Code: Select all
// setup texture
sceGuTexMode(GU_PSM_8888, 2, 0, 0);
sceGuTexFunc(GU_TFX_MODULATE,GU_TCC_RGBA);
sceGuTexOffset(0.0f,0.0f);
sceGuTexWrap(GU_CLAMP, GU_CLAMP);
sceGuTexLevelMode(GU_TEXTURE_AUTO, 0.0f);
sceGuTexFilter(GU_NEAREST_MIPMAP_NEAREST, GU_NEAREST);
sceGuTexImage(0,32,32,32,mip0);
sceGuTexImage(1,32,32,32,mip0);
sceGuTexImage(2,16,16,16,mip1);
sceGuColor(0xffffffff);
sceGuAmbientColor(0xffffffff);
//draw a plane
sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,2*3,0,vertices);
The plane moves away from cam, and nothing happens, it always shows the same texture.