Changeset 29:2e9b106ed4b1
- Timestamp:
- 03/03/08 19:25:40
(4 years ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
moved OpenGl? example into dwtsnippets folder and made it only build if -version=Derelict is set.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r27 |
r29 |
|
| 47 | 47 | [user/torhu_synctest.d] |
|---|
| 48 | 48 | |
|---|
| 49 | | [snippets/opengl_test1.d] |
|---|
| 50 | | prebuild=warn Derelict must be installed |
|---|
| | 49 | version(Derelict){ |
|---|
| | 50 | [dwtsnippets/opengl/Snippet195.d] |
|---|
| | 51 | } |
|---|
| 51 | 52 | |
|---|
| 52 | 53 | [dwtexamples/addressbook/AddressBook.d] |
|---|
| r9 |
r29 |
|
| 12 | 12 | *******************************************************************************/ |
|---|
| 13 | 13 | |
|---|
| 14 | | module opengl_test1; |
|---|
| | 14 | module dwtsnippets.opengl.Snippet195; |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | /* |
|---|
| … | … | |
| 19 | 19 | * For a list of all SWT example snippets see |
|---|
| 20 | 20 | * http://www.eclipse.org/swt/snippets/ |
|---|
| 21 | | * |
|---|
| | 21 | * |
|---|
| 22 | 22 | * @since 3.2 |
|---|
| 23 | 23 | */ |
|---|
| 24 | | |
|---|
| | 24 | |
|---|
| 25 | 25 | import dwt.DWT; |
|---|
| 26 | 26 | import dwt.dwthelper.Runnable; |
|---|
| … | … | |
| 41 | 41 | import Math = tango.math.Math; |
|---|
| 42 | 42 | |
|---|
| 43 | | void drawTorus(float r, float R, int nsides, int rings) |
|---|
| | 43 | void drawTorus(float r, float R, int nsides, int rings) |
|---|
| 44 | 44 | { |
|---|
| 45 | 45 | float ringDelta = 2.0f * cast(float) Math.PI / rings; |
|---|
| … | … | |
| 69 | 69 | } |
|---|
| 70 | 70 | |
|---|
| 71 | | void main() |
|---|
| | 71 | void main() |
|---|
| 72 | 72 | { |
|---|
| 73 | 73 | DerelictGL.load(); |
|---|
| 74 | 74 | DerelictGLU.load(); |
|---|
| 75 | | |
|---|
| | 75 | |
|---|
| 76 | 76 | Display display = new Display(); |
|---|
| 77 | 77 | Shell shell = new Shell(display); |
|---|
| … | … | |
| 89 | 89 | Rectangle bounds = canvas.getBounds(); |
|---|
| 90 | 90 | float fAspect = cast(float) bounds.width / cast(float) bounds.height; |
|---|
| 91 | | |
|---|
| | 91 | |
|---|
| 92 | 92 | glViewport(0, 0, bounds.width, bounds.height); |
|---|
| 93 | 93 | glMatrixMode(GL_PROJECTION); |
|---|
| … | … | |
| 115 | 115 | if (!canvas.isDisposed()) { |
|---|
| 116 | 116 | canvas.setCurrent(); |
|---|
| 117 | | |
|---|
| | 117 | |
|---|
| 118 | 118 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|---|
| 119 | 119 | glClearColor(.3f, .5f, .8f, 1.0f); |
|---|