Page 1 of 1

Graphical Requirement

Posted: Fri Aug 29, 2008 3:11 pm
by Spooky
And now I remember why I stopped building the IRIX builds :cry:

Ever since the addition of the (most excellent) shader update Oolite has required OpenGL 1.4 or greater for the GLSL support. The last version of OpenGL supported on any MIPS based SGI hardware was 1.3 (with a few extra extensions) and official support has now ended for this hardware.

Would there be any interest in a graphics light version of Oolite for people who's boxes aren't quite up to the task?

Posted: Fri Aug 29, 2008 3:50 pm
by another_commander
I have not tested this for ages, but have you tried building with NO_SHADERS defined?

Posted: Sat Aug 30, 2008 1:48 am
by JensAyton
Oolite under OS X still works with OpenGL 1.1 at runtime. Most dependencies on newer versions should be isolated to OOOpenGLExtensionManager.m/h, and go away if you define NO_SHADERS. I’d like the trunk to be buildable with 1.1 if NO_SHADERS is defined, so please report any complications and/or ask for help as necessary.

Posted: Tue Sep 02, 2008 11:19 am
by Spooky
Thanks another_commander and Ahruman.

So far the NO_SHADERS define and IRIX are going nowhere fast. I apologise for the verbose nature of this post but I think it's best that I show you everything that I've done so you can point out my obvious mistake :D

I'm using GNUStep from the Startup 0.20.0, I'm using the SGI development libraries and foundation 1.3, GNU Make 3.81 and I'm compiling with GCC 3.4.6.

Our first stumbling block is the GNUMakefile. I have to add -std=c99 to the CFLAGS and of course -DNO_SHADERS to both CFLAGS and OBJCFLAGS. Then I tweaked the GNUMake.postamble to sort the object file locations. Finally we're ready to

Code: Select all

make debug=no.
And we hit a problem almost immediately, an undeclared isShadered in PlanetEntity.m

Code: Select all

 Compiling file src/Core/Entities/PlanetEntity.m ...
src/Core/Entities/PlanetEntity.m: In function `-[PlanetEntity initAsSunWithColor:]':
src/Core/Entities/PlanetEntity.m:153: error: `isShadered' undeclared (first use in this function)
src/Core/Entities/PlanetEntity.m:153: error: (Each undeclared identifier is reported only once
src/Core/Entities/PlanetEntity.m:153: error: for each function it appears in.)
src/Core/Entities/PlanetEntity.m: In function `-[PlanetEntity initAsAtmosphereForPlanet:dictionary:]':
src/Core/Entities/PlanetEntity.m:357: error: `isShadered' undeclared (first use in this function)
src/Core/Entities/PlanetEntity.m: In function `-[PlanetEntity drawEntity::]':
src/Core/Entities/PlanetEntity.m:1357: error: `isShadered' undeclared (first use in this function)
To get round this I adjusted the defines in PlanetEntity.h to :

Code: Select all

BOOL                                                    isShadered;
#ifndef NO_SHADERS
GLhandleARB                                         shader_program;
#endif
We then trundle through the code until we reach...

Code: Select all

Compiling file src/Core/Universe.m ...
In file included from src/Core/Universe.m:40:
src/Core/OOCPUInfo.h:78:2: #error Neither OOLITE_BIG_ENDIAN nor OOLITE_LITTLE_ENDIAN is defined as nonzero!
make[1]: *** [obj/Universe.o] Error 1
make: *** [oolite.all.objc-program.variables] Error 2
Which I fixed with a quick bodge to OOCPUInfo.h

Code: Select all

#if !defined(OOLITE_BIG_ENDIAN) && !defined(OOLITE_LITTLE_ENDIAN)
#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
#define OOLITE_LITTLE_ENDIAN    1
#endif

// Matches for IRIX

#if defined(__sgi__) || defined(__mips__)
#define OOLITE_BIG_ENDIAN       1
#endif
Next up is OOMesh.m

Code: Select all

 Compiling file src/Core/OOMesh.m ...
src/Core/OOMesh.m: In function `-[OOMesh(Private) setUpMaterialsWithMaterialsDictionary:shadersDictionary:shaderMacros:shaderBindingTarget:]':
src/Core/OOMesh.m:527: error: `OOShaderMaterial' undeclared (first use in this function)
src/Core/OOMesh.m:527: error: (Each undeclared identifier is reported only once
src/Core/OOMesh.m:527: error: for each function it appears in.)
make[1]: *** [obj/OOMesh.o] Error 1
make: *** [oolite.all.objc-program.variables] Error 2
This one is tricky and I'm not sure my solution is particularly good (read as : wrong)

Code: Select all

- (void)setUpMaterialsWithMaterialsDictionary:(NSDictionary *)materialDict
                                                        shadersDictionary:(NSDictionary *)shadersDict
                                                                 shaderMacros:(NSDictionary *)macros
                                                  shaderBindingTarget:(id<OOWeakReferenceSupport>)target
{
        OOMeshMaterialCount             i;
        OOMaterial                              *material = nil;
        
        if (materialCount != 0)
        {
                for (i = 0; i != materialCount; ++i)
                {
                        material = [OOMaterial materialWithName:materialKeys[i]
                                                                          forModelNamed:baseFile
                                                                 materialDictionary:materialDict
                                                                  shadersDictionary:shadersDict
                                                                                         macros:macros
                                                                          bindingTarget:target
                                                                        forSmoothedMesh:isSmoothShaded];
                        #ifndef NO_SHADERS
                        if (material!=nil) 
                        {
                                materials[i] = [material retain];
                        }
                        else
                        {
                                materials[i] = [[OOShaderMaterial placeholderMaterial] retain];
                        }       
                        #else
                        if (material!=nil) 
                        {
                                materials[i] = [material retain];
                        }
                        #endif
                }
        }
//        else
//       {
//                material = [[OOShaderMaterial placeholderMaterial] retain];
//       }


}
It compiles, so that means it must work right? :wink:

Next up is a simple case of IRIX not having an M_PI definition

Code: Select all

Compiling file src/Core/OOOpenGL.m ...
src/Core/OOOpenGL.m: In function `GLDrawBallBillboard':
src/Core/OOOpenGL.m:97: error: `M_PI' undeclared (first use in this function)
src/Core/OOOpenGL.m:97: error: (Each undeclared identifier is reported only once
src/Core/OOOpenGL.m:97: error: for each function it appears in.)
src/Core/OOOpenGL.m: In function `GLDrawOvalPoints':
src/Core/OOOpenGL.m:121: error: `M_PI' undeclared (first use in this function)
make[1]: *** [obj/OOOpenGL.o] Error 1
make: *** [oolite.all.objc-program.variables] Error 2
A quick define in OOOpenGL.h will help with that

Code: Select all

#if !M_PI
#define M_PI 3.14159265358979323846 // Close enough
#endif

#define NULL_SHADER ((GLhandleARB)0)
And that's it, we're compiled. Time to run that bad boy and...

Code: Select all

2008-09-02 04:06:47.562 oolite[5738] [log.header]: Opening log for Oolite version 1.71.2 (<unknown big-endian architecture> test release) under Linux at 2008-09-02 04:06:47 -0700.
1 processors detected.
Note that the contents of the log file can be adjusted by editing logcontrol.plist.

2008-09-02 04:06:47.569 oolite[5738] [unclassified.MyOpenGLView]: initialising SDL
2008-09-02 04:06:47.598 oolite[5738] [unclassified.JoystickHandler]: init: numSticks=0
2008-09-02 04:06:47.600 oolite[5738] [unclassified.MyOpenGLView]: CREATING MODE LIST
2008-09-02 04:06:47.658 oolite[5738] [unclassified.MyOpenGLView]: drawRect calling initialiseGLWithSize
2008-09-02 04:06:47.659 oolite[5738] [unclassified.MyOpenGLView]: Creating a new surface of 800 x 600
2008-09-02 04:06:47.681 oolite[5738] [unclassified.MyOpenGLView]: no universe, clearning surface
2008-09-02 04:06:47.685 oolite[5738] [rendering.opengl.version]: OpenGL renderer version: 1.1.0 ("1.1 Irix 6.5")
Vendor: SGI
Renderer: IMPACT/1/1/4
2008-09-02 04:06:47.686 oolite[5738] [rendering.opengl.extensions]: OpenGL extensions (27):
GL_EXT_abgr GL_EXT_blend_color GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_convolution GL_EXT_copy_texture GL_EXT_histogram GL_EXT_packed_pixels GL_EXT_polygon_offset GL_EXT_subtexture GL_EXT_texture GL_EXT_texture3D GL_EXT_texture_object GL_EXT_vertex_array GL_SGI_color_matrix GL_SGI_color_table GL_SGI_texture_color_table GL_SGIS_texture_filter4 GL_SGIS_detail_texture GL_SGIS_texture_border_clamp GL_SGIS_texture_select GL_SGIS_texture_lod GL_SGIX_list_priority GL_SGIX_pixel_texture GL_SGIX_texture_multi_buffer 
2008-09-02 04:06:47.688 oolite[5738] [dataCache.notFound]: No data cache found, starting from scratch.
2008-09-02 04:06:47.698 oolite[5738] Failed to recurse into directory 'AddOns' - No such file or directory
2008-09-02 04:06:47.699 oolite[5738] Failed to recurse into directory '/.Oolite/AddOns' - No such file or directory
2008-09-02 04:06:47.700 oolite[5738] [searchPaths.dumpAll]: ---> OXP search paths:
("/home/oolite-dev-source-1.71.2/oolite.app/Resources", AddOns, "/.Oolite/AddOns")
2008-09-02 04:06:48.935 oolite[5738] [startup.exception]: ***** Unhandled exception during startup: NSInternalInconsistencyException (Unable to detach thread (last error No such file or directory)).
Unfortunately when I try to run it through gdb it only identifies an unrecognised signal and seems to stuff itself into a perpetual loop.

Any ideas?

Just as a passing shot, although NO_SHADERS will go partially to solving the problem I'm of the opinion that I also really need to produce an OXP with massively trimmed textures, a mechanism for disabling the nebula clouds (or examine their rendering technique). I also need to have serious look at the planet/atmosphere texturing.

Posted: Tue Sep 02, 2008 5:17 pm
by JensAyton
The trunk now builds with NO_SHADERS, and detects endianosity. I can’t really help you with the exception, though; that looks like a GNUstep problem.

Posted: Wed Sep 03, 2008 10:25 am
by Spooky
Good work! It builds perfectly, now I just have to get to the bottom of the GNUStep issue.

Thanks.

Posted: Wed Sep 03, 2008 4:43 pm
by Spooky
Ok, looks like I'm getting somewhere. It looks like the NSInternalInconsistencyException error is being caused by a crappy libobjc runtime and I think the reason I've never noticed it on previous IRIX builds (up to 1.65) was the lack of NSThread use. Looks like I'm gonna have to build a new version of GCC and rebuild GNUstep.

Ahruman,
I've made some cpu detection routines for IRIX and FreeBSD in OOCPUInfo.m which I'll fire up once I get this runtime problem sorted. Also I missed a modification in OOpenGL.h in my previous post.

Code: Select all

#ifndef NO_SHADERS
#include <GL/glext.h>
#endif

Posted: Wed Sep 03, 2008 5:36 pm
by CmdrLUke
Just my $0.02: shaders are cool and all, but most of the variety needed in most cases comes from simple texturing. Adding Sung's textures for example really gives a massive step forward in visual richness at fairly small cost. I find specular highlights, etc. distracting.

I think the absolutely most important thing is to peg the framerate at 60+fps at all times, that should be doable on almost all systems even with fairly rich texture mapping.

Probably the best thing is just to make sure the switches for low/medium/high/off detail stay in the game so players can make the trade-off themselves.

Posted: Wed Sep 03, 2008 9:03 pm
by JensAyton
Oolite 1.71 has better graphical performance than 1.65 on just about any system with any sort of hardware acceleration, and does not have higher system requirements. The settings are in the game, and no-one’s planning to take them away.

The issue in this thread is related to building for operating systems which provide old versions of OpenGL, where supporting shaders at all is not possible. Maintaining that ability has always been my goal, and the obstacles to it (now overcome) were very small.

Posted: Thu Sep 04, 2008 8:20 am
by Spooky
I completely concur with Ahruman, anything that I'm doing here is purely for machines that are practically antiques. Obviously I want to keep any work I do in line with the trunk so that people with machines that aren't so 'dusty' can choose to leverage the changes and improve their gameplay.

60fps :D

On my test machine (a 1995 vintage Indigo2 with a 195Mhz processor 768M of RAM and a graphics system with 1mb of texture ram) I'm lucky if I push 20 in v1.65