bzr branch
/browse/iphone/common
| Line | Revision | Contents |
| 1 | 20 | // |
| 2 | // ES1Shader.m |
|
| 3 | // |
|
| 4 | // Created by döme on 08.08.2009. |
|
| 5 | // |
|
| 6 | ||
| 7 | 54 | /* |
| 8 | * Copyright (c) 2009 Doemoetoer Gulyas. |
|
| 9 | * All rights reserved. |
|
| 10 | * |
|
| 11 | * Redistribution and use in source and binary forms, with or without |
|
| 12 | * modification, are permitted provided that the following conditions |
|
| 13 | * are met: |
|
| 14 | * 1. Redistributions of source code must retain the above copyright |
|
| 15 | * notice, this list of conditions and the following disclaimer. |
|
| 16 | * 2. Redistributions in binary form must reproduce the above copyright |
|
| 17 | * notice, this list of conditions and the following disclaimer in the |
|
| 18 | * documentation and/or other materials provided with the distribution. |
|
| 19 | * 3. The name of the author may not be used to endorse or promote products |
|
| 20 | * derived from this software without specific prior written permission. |
|
| 21 | * |
|
| 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
| 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
| 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
| 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
| 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
| 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
| 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
| 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 32 | */ |
|
| 33 | ||
| 34 | 20 | #import "ES1Shader.h" |
| 35 | ||
| 36 | #import <OpenGLES/ES1/gl.h> |
|
| 37 | ||
| 38 | @implementation ES1Shader |
|
| 39 | ||
| 40 | - (id) init |
|
| 41 | { |
|
| 42 | if (!(self = [super init])) |
|
| 43 | return nil; |
|
| 44 | ||
| 45 | modelviewMatrix = midentity(); |
|
| 46 | projectionMatrix = midentity(); |
|
| 47 | textureMatrix = midentity(); |
|
| 48 | ||
| 49 | return self; |
|
| 50 | } |
|
| 51 | ||
| 52 | - (void) dealloc |
|
| 53 | { |
|
| 54 | ||
| 55 | } |
|
| 56 | ||
| 57 | - (void) bindShader |
|
| 58 | { |
|
| 59 | ||
| 60 | } |
|
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | - (void) setModelviewMatrix: (m16*) m |
|
| 65 | { |
|
| 66 | modelviewMatrix = *m; |
|
| 67 | glMatrixMode(GL_MODELVIEW); |
|
| 68 | glLoadMatrixf(modelviewMatrix.a); |
|
| 69 | } |
|
| 70 | - (void) setProjectionMatrix: (m16*) m |
|
| 71 | { |
|
| 72 | projectionMatrix = *m; |
|
| 73 | glMatrixMode(GL_PROJECTION); |
|
| 74 | glLoadMatrixf(projectionMatrix.a); |
|
| 75 | } |
|
| 76 | - (void) setTextureMatrix: (m16*) m |
|
| 77 | { |
|
| 78 | textureMatrix = *m; |
|
| 79 | glMatrixMode(GL_TEXTURE); |
|
| 80 | glLoadMatrixf(textureMatrix.a); |
|
| 81 | } |
|
| 82 | ||
| 83 | 23 | - (void) setColorRed: (float) r green: (float) g blue: (float) b alpha: (float) a |
| 84 | { |
|
| 85 | glColor4f(r,g,b,a); |
|
| 86 | } |
|
| 87 | ||
| 88 | 20 | |
| 89 | @end |
|
| 90 |
Loggerhead 1.17 is a web-based interface for Bazaar branches