PSP GU <-> PC OpenGL advice

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Brunni
Posts: 186
Joined: Sat Oct 08, 2005 10:27 pm

PSP GU <-> PC OpenGL advice

Post by Brunni »

Hello,

I'm trying to do a PC implementation of OSLib, but in fact I have to reimplement nearly completely the sceGu.
The problem is, with OpenGL, some things are missing or used differently. For example, color keying (GU_COLOR_TEST), stencil buffer, advanced blending or sceGuDrawBuffer.
Especially, I use stencil as a special mean of writing alpha to the drawbuffer. But I can't find any equivalent with OpenGL (stencil exists, but I think it's not written to the destbuffer alpha, but on the depthbuffer instead, and no way to read it).
I tried with software rendering, but it's really slow (I'm just drawing gouraud-shaded & textured polygons without any state for now and it's already slower than on PSP).

So, I would like some advice, if I should rather head for software or hardware acceleration, and if OpenGL problems & missing things can be corrected or replaced by something equivalent... the goal would mainly be accuracy for testing purposes, but at an acceptable framerate (like 5 fps) else it's unuseful for animation testing.

Thank you in advance ^^
Sorry for my bad english
Image Oldschool library for PSP - PC version released
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

I don't think it's impossible to achieve what you want with OpenGL, but some things might be tricky to do. I couldn't give you straight solutions though, so some searching on the internet would be required.

Regarding the speed, there's no arguing on whether to use GL or software rendering, but if you really only aim for debugging purpose and even only 5fps is good enough, software rendering should suffice, yet would be more code to write. But that would be something where I could most likely greatly help you, since I wrote some software rendering engines already, which were all pretty fast for their caps (using bilinear filtering, perspective correction and alphablending) and garouded textured polys is something totally basic. If done properly, it should be able to run at 'playable' speed of > 25fps, depending on the complexity of your scenes.
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

If you just want to render to destination alpha, and you are not really using any stencil ops, then you can use glColorMask to block writing to the color channels. I think the PSP equivalent ins sceGuPixelMask (which sounds like it is specific to the current display color mode).

Color keying is something you can easily do in a pixel shader. Since on PC you have the textures lookups to spare maybe a trivial way would be to have 3 1D texture lookups. Some of the other PSP tricks can propably also handled using pixel shaders.

The most annoying might be the color logical ops, opengl supports them only in indexed color mode. It can be done, but a simple thing suddenly gets overly complex :)

Maybe easier way would be to write a wrapper library instead and use only the features that are available on both platforms. You could easily bias the implementation to work optimal on PSP and still get the same performance on PC too.
Post Reply