1

I am currently taking a Game Console Programming module at Sunderland University. What they are teaching in this module is OpenGL and Phyre Engine to develop PS3 game.

The fact that PS3 SDK kit is not available for free (it is quite expensive) makes it really difficult for me to get around when a problem arises.

Apparently, PS3 framework doesn't support most of the gl function calls like glGenList, glBegin, glEnd and so on.

glBegin(GL_QUADS);
    glTexCoord2f(TEXTURE_SIZE, m_fTextureOffset);
    glVertex3f(-100, 0, -100);

    //some more
glEnd();

I get errors when debugging with PS3 debug mode at glBegin, glEnd and glTexCoord2f.

Is there any way to get around it? like a different way of drawing object, perhaps?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Thang Do
  • 316
  • 2
  • 16

3 Answers3

4

Most games developed for the PS3 don't use OpenGL at all, but are programmed "on the metal" i.e. make direct use of the GPU without an intermediate, abstrace API. Yes, there is a OpenGL-esque API for the PS3, but this is actually based on OpenGL-ES.

In OpenGL-ES there is no immediate mode. Immediatate Mode is this cumbersome method of passing geometry to OpenGL by starting a primitive with glBegin and then chaining up calls of vertex attribute state setting, concluded by submitting the vertex by its position glVertex and finishing with glEnd. Nobody wants to use this! Especially not on a system with limited resources.

You have the geometry data in memory available anyway. So why not simply point OpenGL to use what's already there? Well, that's exactly what to do: Vertex Arrays. You give OpenGL pointers to where find data (generic glVertexAttribPointer in modern OpenGL, or in old fixed function the predefined, fixed attributesglVertexPointer, glTexCoordPointer, glNormalPointer, glColorPointer) and then have it draw a whole bunch of it using glDrawElements or glDrawArrays.

In modern OpenGL the drawing process is controlled by user programmable shaders. In fixed function OpenGL all you can do is parametize a inflationary number of state variables.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • 1
    The IMHO best tutorial on OpenGL these days is written by Nicol Bolas, available at http://arcsynthesis.org/gltut – however it is targeted at OpenGL-3 and not OpenGL-ES, so it's not directly applicable to what's available on the PS3. Still if you work through this on your PC you'll learn a lot of usefull things. – datenwolf Apr 20 '13 at 02:10
  • Actually on PS3 there is always an API between the programmer and the hardware, albeit a lower level abstraction than GL. Gone are the days of direct hardware access on consoles. – JasonD Apr 20 '13 at 11:35
2

The OpenGL used by the PlayStation 3 is a variant of OpenGL ES 1.0 (according to wikipedia with some features of ES 2.0).

http://www.khronos.org/opengles/1_X

Has the specification. There doesn't seem to be glBegin/glEnd functions there. Those (as in, fixed pipeline functions) are deprecated (and with OpenGL 4.0 and OpenGL ES 2.0, removed) in favor of things like VBO's anyway though, so there probably isn't much point in learning how to work with these.

Cubic
  • 14,902
  • 5
  • 47
  • 92
  • Should I make an array of vertex and an array of texture? I found a couple of functions like glMultiTexCoord4f(), which uses a pointer to an array of vertex (?!). – Thang Do Apr 20 '13 at 00:34
  • I just realised what you meant by VBO (Vertex Buffer Object). I managed to find a couple of related tutorials. It seems like I'm going in a right direction here. Thanks a lot @Cubic. – Thang Do Apr 20 '13 at 00:52
  • 1
    @Cubic: Fixed function pipeline has nothing to do with Immediate Mode vs. Vertex Arrays. Fixed function pipeline is about absence of freely programmable shaders. Completely different concept. – datenwolf Apr 20 '13 at 00:57
  • 1
    @datenwolf I know, though I see my wording here is pretty misleading. I should've said immediate mode and FFP is deprecated. – Cubic Apr 20 '13 at 11:32
  • Here's a deck describing the difference between vanilla GLES and PSGL: www.khronos.org/assets/uploads/developers/library/siggraph2006/OpenGL_ES_BOF/OpenGL-ES-Demos.ppt –  May 07 '13 at 18:47
0

If you are using PhyreEngine, you should generally avoid directly calling the graphics API directly, as PhyreEngine sits on top of different APIs on different platforms.

On PC it uses GL (or D3D), but on PS3 it uses a lower-level API. So even if you used GL-ES functionality, and even if it compiles, it will likely not function. So it's not surprising you are seeing errors when building for PS3.

Ideally you should use PhyreEngine's pipeline for drawing, which is platform-agnostic. If you stick to that API, you can in principle compile your code for any supported platform.

There is a limit to how much I can comment on PhyreEngine publicly (sorry), but if you are on a university course, your university should have access to the official support forums where you could get more specific help.

If you really must target the underlying graphics API directly, be aware that you may need to write/modify your code per-platform, and that you will need to 'play nice' with any contextual state that PhyreEngine may rely on.

JasonD
  • 16,464
  • 2
  • 29
  • 44