OpenGX

From gc-linux

Jump to: navigation, search

OpenGX is a wrapper library that simulates OpenGL ontop of the LibGX 3D library. Its currently in early alpha stages but simple rendering and coloring is working.


Contents

Getting

Before you start make sure you have gcc and g++ installed on your build machine, you also need to have LibGX installed, atleast gx.h and gu.h installed in /usr/local/include and gx.so and gx.a in /usr/local/lib, you can get the binaries for that here, also make a softlink to gx.so.0.0.0 in /usr/local/lib

ln -sf gx.so.0.0.0 gx.so

You can get the source from here. Then do this.

cd OpenGX
make
make install

You should get alot of warnings from gl_not_impl.cpp thats normal. You can now try out TestGL, scine that doesn't use SDL

cd TestGL
make
make run

To get SDL in you need to first download the sdl.tar.bz2 file and extract that and do this.

cd SDL-1.2.8
./configure --without-x --disable-video-x11 --disable-video-fbcon --disable-video-aalib --enable-video-opengl
make
make install

Note if you want to test the quake2 thing you need to have extra swap mounted, one file takes about 20mb extra swap then the 16 you have on /dev/aram. Note you won't need that if you don't compile with ref_sdlgl.


Status

Work is progresssing quite nicely at the time of writing, we hope to have basic texturing support in soon.

OpenGL 1.1

* Matrix functions 90% (More testing needs to be done, ortho isn't supported.)
* Rendering modes 70% (Not all mode supported)
* Color 90% (Coloring works, not all functions are supported.)
* Textures 0%
* Lighting 0%
* DisplayLists 0%
* StateMachine 10%
* Query functions 0%
* VertexArrays 0%

Extentions

* GL_ARB_multitexture 0%

Screenshots

Image:quake2.png

Quake2 running on a early version of OpenGX, date:2006-04-04


Goals

Rotating cube

Yes you can see a rotating cube on the screen while the backgrounds flashes in strange colors. This was the first test I made and it tests most of the matrix functions, the test also currently uses some of OpenGX glu replacment funktions, like ogxFrustum and ogxLookAt.

SDLgears

The standard gears test, it doesn't work that well since most of the rendering is done with GL_QUAD_STRIP and as such doesn't show up. It makes heavy use of DisplayLists, modifing it to not use lists solved that, but we want it to work out of the box. During testing it was shown that some of the matrix functions wasn't correct, they have been corrected thanks to this. This goal is currently on hold, as DisplayLists are simple to tedius to implement and won't really show an improvement.

Quake2

The ultimet goal is to make as many as possible of the games that uses SDL and OpenGL possible to run without modifactions. Quake2 currently runs completly in software on the cube so all that is fixed. It also "runs" with out crashes with OpenGX and renders correctly if you can call untextured and unlitt correctly, but its a good base to start with. Also Quake2 doesn't appear to use OpenGLs lighting functions and as such will be it will take less time to fully support Quake2. Quake2 is the current program we are hopeing to fully support with OpenGX.


Breaking the OpenGL specs

glColor and glVertex

Currently not all functions are implemented, but simple rendering with colors works.

FrameBuffer

LibGX doesn't realy provide tools for clearing the framebuffer in itself but instead clears the buffer when it copies it to the visible framebuffer. This also means that you can not change rendering targets to and from the front and back buffers and that you are looked to the back buffer.

Textureing

The cube doesn't realy support 1D or 3D textures so we can't fully support more then OpenGL 1.1 on the texture aspect. We can't probably support OpenGL 1.1 fully for that matter, but we can look at what features programs and games use and try to implement them. Also I don't think its possible to support borders either.

Rendering

The biggest problem with libGX is that you have to specify in beforehand how many vertexs to be sent to the GX so we need to buffer all the vertecies in a buffer and then read from that buffer to GX.

Rendering Modes

GL_LINE_LOOP, GL_QUAD_STRIP and GL_POLYGON is not supported

  • GL_LINE_LOOP: can be supported with a special case of just sending the first vertex to GX
  • GL_QUAD_STRIP: can be supported with GL_TRIANGLE_STRIP if you swap plases with pairs of two after the first to vertexes.
  • GL_POLYGON: is currently supported with GL_TRIANGLE_FAN, but if N < 3 its is ignored.

Display Lists

We probably have to make our own display list implementation, which is a lot of work, and since Quake2 doesn't use them they probably wont come in a hurry, or be correctly implemented for that matter.

Personal tools