textures, blitting, array in VRAM, and etc...
textures, blitting, array in VRAM, and etc...
hello, everyone.
i have some few questions.
1st: i tried to programmed some tests, few models from maya with one texture coded to 5650 or 4444 16 bit - just for test.
now i coded own convertor for textures from 4bit indexed and 16bit palette 5650 up to 32b 8888 format. Tester for 8kb cache (if converted texture will be equal or less than 8kb), swizzler and etc..... (any improvments?)
BUT, in ogl i had a managment of textures, that could bind any texture. I used
glBindTexture(GL_TEXTURE_2D, texture_id);
is this command(s) equal?
sceGuTexMode(GU_PSM_5650,0,0,0); //propably needed?
sceGuTexImage(0,128,128,128,texture_data);
if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest);
is palette of indexed texure possible to load to vram too?
2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
i am using model with indexes:
sceGumDrawArray (GU_TRIANGLES, GU_TEXTURE_8BIT|GU_COLOR_4444|GU_VERTEX_32BITF|GU_TRANSFORM_3D|GU_INDEX_16BIT, 8172, model_i_start, model_start);
this components are for max mem saving:
GU_TEXTURE_8BIT
GU_COLOR_4444
GU_VERTEX_32BITF
GU_INDEX_16BIT
i tried to reduce it more, but it was little bit unnatural. could it be reduced more? why in the hell, there's no GU_VERTEX_16BITF? in a lot of models, it should be enought
PS: sorry for my terrible english ;-)
i have some few questions.
1st: i tried to programmed some tests, few models from maya with one texture coded to 5650 or 4444 16 bit - just for test.
now i coded own convertor for textures from 4bit indexed and 16bit palette 5650 up to 32b 8888 format. Tester for 8kb cache (if converted texture will be equal or less than 8kb), swizzler and etc..... (any improvments?)
BUT, in ogl i had a managment of textures, that could bind any texture. I used
glBindTexture(GL_TEXTURE_2D, texture_id);
is this command(s) equal?
sceGuTexMode(GU_PSM_5650,0,0,0); //propably needed?
sceGuTexImage(0,128,128,128,texture_data);
if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest);
is palette of indexed texure possible to load to vram too?
2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
i am using model with indexes:
sceGumDrawArray (GU_TRIANGLES, GU_TEXTURE_8BIT|GU_COLOR_4444|GU_VERTEX_32BITF|GU_TRANSFORM_3D|GU_INDEX_16BIT, 8172, model_i_start, model_start);
this components are for max mem saving:
GU_TEXTURE_8BIT
GU_COLOR_4444
GU_VERTEX_32BITF
GU_INDEX_16BIT
i tried to reduce it more, but it was little bit unnatural. could it be reduced more? why in the hell, there's no GU_VERTEX_16BITF? in a lot of models, it should be enought
PS: sorry for my terrible english ;-)
dont wanna use pspgl, just tring to find native equivalent.holger wrote:Use pspgl if you want access the GE using OpenGL semantics. Prefer the SVN version if you provide your data in PSP native format, or Jeremy's tree if you want to let the library handle the texture and vertex format conversion.
SVN version or Jeremy's tree? gee, i want to do it by myself :) that's why I am asking :)
Re: textures, blitting, array in VRAM, and etc...
Have a look at PSPGL (http://www.goop.org/psp/gl/).outtony wrote:BUT, in ogl i had a managment of textures, that could bind any texture. I used
glBindTexture(GL_TEXTURE_2D, texture_id);
LibGU is lower level than GL, and does no texture management for you.
Yep, that's basically right. You need to make sure the texture has been flushed out of the CPU cache if you've modified it.sceGuTexMode(GU_PSM_5650,0,0,0); //propably needed?
sceGuTexImage(0,128,128,128,texture_data);
if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest);
Yep.is palette of indexed texure possible to load to vram too?
You can use GU_VERTEX_16BIT, which is integral, so you need to scale everything by 32767. You can use the model matrix to scale your model down to the size you actually want.2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
i am using model with indexes:
sceGumDrawArray (GU_TRIANGLES, GU_TEXTURE_8BIT|GU_COLOR_4444|GU_VERTEX_32BITF|GU_TRANSFORM_3D|GU_INDEX_16BIT, 8172, model_i_start, model_start);
this components are for max mem saving:
GU_TEXTURE_8BIT
GU_COLOR_4444
GU_VERTEX_32BITF
GU_INDEX_16BIT
i tried to reduce it more, but it was little bit unnatural. could it be reduced more? why in the hell, there's no GU_VERTEX_16BITF? in a lot of models, it should be enought
Similarly, 8-bit texture coords are integral, so you need to use the texture matrix to scale them to the 0..1 range for texture coords (which I haven't had much success with), or change the texture scaling (using sceGuTexScale).
If you're new to the PSP, then the big gotcha is cache management. PSPGL handles all this for you, but otherwise see http://www.goop.org/psp/cache-howto.html.
Re: textures, blitting, array in VRAM, and etc...
Oh, one other thing. After the copy, you'll need:outtony wrote:if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest);
Code: Select all
sceGuTexSync(); // make sure the copy finishes before starting to use it
sceGuTexFlush(); // clear the previous texture out of the GE texture cache
Re: textures, blitting, array in VRAM, and etc...
i am looking for psp native replacement, or some way to code itjsgf wrote: Have a look at PSPGL (http://www.goop.org/psp/gl/).
LibGU is lower level than GL, and does no texture management for you.
>Yep.is palette of indexed texure possible to load to vram too?
how?
that link is about cache, not about vram2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
Re: textures, blitting, array in VRAM, and etc...
Well, the code for PSPGL is full of useful stuff.outtony wrote:i am looking for psp native replacement, or some way to code itjsgf wrote: Have a look at PSPGL (http://www.goop.org/psp/gl/).
LibGU is lower level than GL, and does no texture management for you.
Copy it there and point to it. VRAM is directly accessable to the CPU; its just memory as far as software is concerned. sceGeEdramGetAddr() returns a pointer to the start.>Yep.is palette of indexed texure possible to load to vram too?
how?
Right. VRAM is just memory, so you can copy your vertex data there. But it's cachable, so you need to make sure you've flushed it.that link is about cache, not about vram2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
Re: textures, blitting, array in VRAM, and etc...
pspgl is native... what did you believed the 'psp' stands for? ;)outtony wrote:i am looking for psp native replacement, or some way to code itjsgf wrote:Have a look at PSPGL (http://www.goop.org/psp/gl/).
LibGU is lower level than GL, and does no texture management for you.
use sceGuCopyImage, you can also copy vertex data using these calls (pass stride and buffer width so that your data is continously transferred). Alternatively you can also access the DMAC directly or use memcpy, if you don't care about CPU load.outtony wrote:>Yep.is palette of indexed texure possible to load to vram too?
how?
2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
Re: textures, blitting, array in VRAM, and etc...
oh, that's truth :)
Re: textures, blitting, array in VRAM, and etc...
yp, and that "native" gl doesnt support a lot of stuff (at the moment)holger wrote: pspgl is native... what did you believed the 'psp' stands for? ;)
for ex. sprites primitive or vertex weights...
outtony wrote:I can't google any information about it. Could you please tell me, where can I find any informations? thank you ;-)holger wrote:please take a closer look, Jeremy's tree has them incorporated as extensions. More are not too hard to add.
I don't currently have a vertex weight extension that I like yet, but I did just implement Bezier patch surfaces...I wrote:Have a look at PSPGL (http://www.goop.org/psp/gl/).
Sprites are on my TODO list, but they're trivial to add (not interesting enough to get around to).