summaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-12-08 21:29:29 +0800
committerchai <chaifix@163.com>2019-12-08 21:29:29 +0800
commit69d8af71d6882e801496fcd7ed971081c0b720d8 (patch)
tree452f7d037cf977e4a934d433bd2f12c03ed1ea10 /src/example
parent31be0df6255ef704bed28d2be56acbe1cea7caad (diff)
*misc
Diffstat (limited to 'src/example')
-rw-r--r--src/example/03_texture.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/example/03_texture.c b/src/example/03_texture.c
index acb85c4..d4e08a4 100644
--- a/src/example/03_texture.c
+++ b/src/example/03_texture.c
@@ -10,20 +10,22 @@ static int cube[] = {
};
static Vert verts[] = {
- {0, {1, 1, 1}, {1, 1, 1}, zerovec3, zerovec2, 0xffff0000},
- {1, {-1, 1, 1}, {-1, 1, 1}, zerovec3, zerovec2,0xff00ff00},
- {2, {-1, -1, 1}, {-1, -1, 1}, zerovec3, zerovec2, 0xff0000ff},
- {3, {1, -1, 1}, {1, -1, 1}, zerovec3, zerovec2, 0xffff00ff},
- {4, {1, 1, -1}, {1, 1, -1}, zerovec3, zerovec2, 0xffaa28aa},
- {5, {-1, 1, -1}, {-1, 1, -1}, zerovec3, zerovec2,0xffFFC58E},
- {6, {-1, -1, -1}, {-1, -1, -1}, zerovec3, zerovec2, 0xffA100FF},
- {7, {1, -1, -1}, {1, -1, -1}, zerovec3, zerovec2, 0xffFAFF00},
+ {0, {1, 1, 1}, {1, 1, 1}, zerovec3, {1, 1}, 0xffff0000},
+ {1, {-1, 1, 1}, {-1, 1, 1}, zerovec3, {0, 1},0xff00ff00},
+ {2, {-1, -1, 1}, {-1, -1, 1}, zerovec3, {0, 0}, 0xff0000ff},
+ {3, {1, -1, 1}, {1, -1, 1}, zerovec3, {1, 0}, 0xffff00ff},
+ {4, {1, 1, -1}, {1, 1, -1}, zerovec3, {1, 0} , 0xffaa28aa},
+ {5, {-1, 1, -1}, {-1, 1, -1}, zerovec3, {0, 0},0xffFFC58E},
+ {6, {-1, -1, -1}, {-1, -1, -1}, zerovec3, {0, 1}, 0xffA100FF},
+ {7, {1, -1, -1}, {1, -1, -1}, zerovec3, {1, 1} , 0xffFAFF00},
};
extern Program ssr_built_in_shader_unlit;
static Vec3 light = {-1, -1, -1};
+static Texture* texture;
+
void onloadtexture(void* data) {
ssr_matrixmode(MATRIX_PROJECTION);
ssr_loadidentity();
@@ -38,6 +40,12 @@ void onloadtexture(void* data) {
ssr_useprogram(&ssr_built_in_shader_unlit);
ssr_enable(ENABLEMASK_BACKFACECULL);
ssr_enable(ENABLEMASK_DEPTHTEST);
+
+ texture = texture_loadfromfile("res/helmet/screenshot2.png");
+ ssr_setuniformtex(0, texture);
+
+ ssr_setwrapmode(WRAPMODE_CLAMP);
+ ssr_setfiltermode(FILTERMODE_POINT);
}
void oneventtexture(void* data) {