Changeset 55:f3d8c0441408
- Timestamp:
- 06/10/08 12:35:13
(7 months ago)
- Author:
- Diggory Hardy <diggory.hardy@gmail.com>
- branch:
- default
- Message:
Implemented gl.texture (without testing) & fixed log options adjusted previously.
Implemented gl.texture module to load textures from file (untested).
Fixed log level/option setting in Init.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r53 |
r55 |
|
| 9 | 9 | To do (importance 0-5: 0 pointless, 1 no obvious impact now, 2 todo sometime, 3 useful, 4 important, 5 urgent): |
|---|
| 10 | 10 | Also see todo.txt and FIXME/NOTE comment marks. |
|---|
| 11 | | 5 mergetag crashes with no ending > on a tag and doesn't add header data when comments are included! |
|---|
| 12 | | 4 LCD filtering / fonts from Options. Get yMax for font not all glyphs on line? |
|---|
| | 11 | 4 Fonts from Options. Get yMax for font not all glyphs on line? |
|---|
| 13 | 12 | 4 Not guaranteed to catch up-click ending callback! Appears not to be a problem... |
|---|
| 14 | 13 | 4 OutOfMemoryException is not currently checked for â it should be at least in critical places (use high-level catching of all errors?). |
|---|
| … | … | |
| 53 | 52 | |
|---|
| 54 | 53 | Done (for git log message): |
|---|
| | 54 | Implemented gl.texture module to load textures from file (untested). |
|---|
| | 55 | Fixed log level/option setting in Init. |
|---|
| r53 |
r55 |
|
| 4 | 4 | <bool|exitImmediately=false> |
|---|
| 5 | 5 | <char[]|L10n="en-GB"> |
|---|
| 6 | | <int|logLevel=1> |
|---|
| 7 | | <int|logOptions=0x1003> |
|---|
| | 6 | <int|logOptions=0x3001> |
|---|
| 8 | 7 | <double|pollInterval=0.01> |
|---|
| 9 | 8 | |
|---|
| r29 |
r55 |
|
| 67 | 67 | } |
|---|
| 68 | 68 | |
|---|
| | 69 | /// Thrown when an image fails to load or cannot be loaded to a texture (unsupported format?). |
|---|
| | 70 | class ImageException : mdeException { |
|---|
| | 71 | char[] getSymbol () { |
|---|
| | 72 | return super.getSymbol ~ ".gl.texture"; |
|---|
| | 73 | } |
|---|
| | 74 | this (char[] msg) { |
|---|
| | 75 | super (msg); |
|---|
| | 76 | } |
|---|
| | 77 | } |
|---|
| | 78 | |
|---|
| | 79 | |
|---|
| 69 | 80 | debug (mdeUnitTest) { |
|---|
| 70 | 81 | import tango.util.log.Log : Log, Logger; |
|---|
| r49 |
r55 |
|
| 42 | 42 | |
|---|
| 43 | 43 | GLenum err = glGetError(); |
|---|
| 44 | | if (err != GL_NO_ERROR) { |
|---|
| | 44 | while (err != GL_NO_ERROR) { |
|---|
| 45 | 45 | char[128] tmp; |
|---|
| 46 | 46 | logger.error (logger.format (tmp, "GL error: {}", err)); |
|---|
| | 47 | err = glGetError(); |
|---|
| 47 | 48 | } |
|---|
| 48 | 49 | |
|---|
| r53 |
r55 |
|
| 51 | 51 | import derelict.opengl.gl; |
|---|
| 52 | 52 | import derelict.sdl.sdl; |
|---|
| | 53 | import derelict.sdl.image; |
|---|
| 53 | 54 | import derelict.freetype.ft; |
|---|
| 54 | 55 | import derelict.util.exception; |
|---|
| … | … | |
| 161 | 162 | try { |
|---|
| 162 | 163 | enum LOG { |
|---|
| 163 | | LEVEL = 0x10, // mask for log level |
|---|
| 164 | | CONSOLE = 0x1001, // log to console? |
|---|
| 165 | | ROLLFILE= 0x1002 // use Rolling/Switching File Appender? |
|---|
| | 164 | LEVEL = 0xF, // mask for log level |
|---|
| | 165 | CONSOLE = 0x1000, // log to console? |
|---|
| | 166 | ROLLFILE= 0x2000 // use Rolling/Switching File Appender? |
|---|
| 166 | 167 | } |
|---|
| 167 | 168 | |
|---|
| … | … | |
| 171 | 172 | |
|---|
| 172 | 173 | // Now re-set the logging level, using the value from the config file: |
|---|
| 173 | | Log.getRootLogger.setLevel (cast(Log.Level) (miscOpts.logOptions & LOG.LEVEL), true); |
|---|
| | 174 | root.setLevel (cast(Log.Level) (miscOpts.logOptions & LOG.LEVEL), true); |
|---|
| 174 | 175 | |
|---|
| 175 | 176 | // Log to a file (first appender so root seperator messages don't show on console): |
|---|
| … | … | |
| 208 | 209 | try { |
|---|
| 209 | 210 | DerelictSDL.load(); |
|---|
| | 211 | DerelictSDLImage.load(); |
|---|
| 210 | 212 | DerelictGL.load(); |
|---|
| 211 | 213 | DerelictFT.load(); |
|---|
| r54 |
r55 |
|
| 123 | 123 | * The initial loading provides opengl 1.1 features. |
|---|
| 124 | 124 | * |
|---|
| | 125 | * 1.4 is now used for glBlendColor (coloured text). |
|---|
| | 126 | * |
|---|
| 125 | 127 | * Currently the latest version used is 1.3; adjust this as necessary. However, before using |
|---|
| 126 | 128 | * features from any OpenGL version > 1.1 a check must be made on what was loaded by calling |
|---|
| … | … | |
| 128 | 130 | * the highest supported version but this way we know what we're getting. |
|---|
| 129 | 131 | */ |
|---|
| 130 | | try { |
|---|
| 131 | | DerelictGL.loadVersions(GLVersion.Version13); |
|---|
| | 132 | if (DerelictGL.availableVersion < GLVersion.Version13) { |
|---|
| | 133 | logger.fatal ("Required at least OpenGL 1.3"); |
|---|
| | 134 | setInitFailure; |
|---|
| | 135 | return; |
|---|
| | 136 | } |
|---|
| | 137 | /+try { |
|---|
| | 138 | DerelictGL.loadVersions(GLVersion.Version14); |
|---|
| 132 | 139 | } catch (SharedLibProcLoadException e) { |
|---|
| 133 | | logger.warn ("Loading OpenGL version 1.3 failed:"); |
|---|
| | 140 | logger.warn ("Loading OpenGL version 1.4 failed:"); |
|---|
| 134 | 141 | logger.warn (e.msg); |
|---|
| 135 | 142 | |
|---|
| … | … | |
| 139 | 146 | return; |
|---|
| 140 | 147 | +/ |
|---|
| 141 | | } |
|---|
| | 148 | }+/ |
|---|
| 142 | 149 | |
|---|
| 143 | 150 | // OpenGL stuff: |
|---|