summaryrefslogtreecommitdiffhomepage
path: root/src/main.c
diff options
context:
space:
mode:
authorarngo <[email protected]>2024-05-16 21:00:51 -0400
committerarngo <[email protected]>2024-05-16 21:00:51 -0400
commit0e1c3d42a93f623f60284f7e9acfd014e41ddadc (patch)
tree701cd9cef7e0e7210dba9ac77e2bad9a87b8c5e9 /src/main.c
parent21ab7c1df0b8a0fcbb1d10ed2e61410d7f7021e0 (diff)
downloadtojam2024-textures.tar.gz
tojam2024-textures.zip
loading and draw textures for skyboxtextures
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 8893e4f..e834962 100644
--- a/src/main.c
+++ b/src/main.c
@@ -65,6 +65,15 @@ World world = {
}
};
+char *sprite_paths[] =
+{
+ "rom:/1_32px.sprite",
+ "rom:/2_32px.sprite",
+ "rom:/3_32px.sprite",
+ "rom:/4_32px.sprite",
+ "rom:/5_32px.sprite",
+ "rom:/6_32px.sprite",
+};
int main(void)
{
@@ -86,8 +95,28 @@ int main(void)
camera2.fovy = 35.0f;
camera2.projection = CAMERA_PERSPECTIVE;
+ Camera camerax = { 0 };
+ camerax.position = (Vector3){ 0.0f, 0.0f, 15.0f };
+ camerax.target = (Vector3){ 0.0f, 0.0f, 0.0f };
+ camerax.up = (Vector3){ 0.0f, 1.0f, 0.0f };
+ camerax.fovy = 45.0f;
+ camerax.projection = CAMERA_PERSPECTIVE;
+
+ sprite_t *sprites[6];
+ GLuint textures[6];
+ glGenTextures(6, textures);
+ for (int i = 0; i < 6; i++)
+ {
+ textures[i] = customLoadTextureN64(sprite_paths[i]);
+ }
+
SetTargetFPS(60);
+ GLuint dl_skybox = glGenLists(1);
+ glNewList(dl_skybox, GL_COMPILE);
+ renderSkybox(textures, 2, 3, camera);
+ glEndList();
+
while (!WindowShouldClose())
{
updateController();
@@ -138,6 +167,9 @@ int main(void)
BeginDrawing();
ClearBackground(BLACK);
+ BeginMode3D(camerax);
+ glCallList(dl_skybox);
+ EndMode3D();
BeginScissorMode(0, 0, 320/2, 240);
rlViewport(0, 0, 320/2, 240);
renderWorld(&world, camera);