From 012bc114879f9b930707782ab89ffd31d73dbbf0 Mon Sep 17 00:00:00 2001 From: Andre Meyering Date: Wed, 28 Nov 2018 15:48:19 +0100 Subject: [PATCH] [Code] Update --- Code/template_meshVisualisierung_textur.c | 25 ++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Code/template_meshVisualisierung_textur.c b/Code/template_meshVisualisierung_textur.c index f1976cb..d8ecc5e 100644 --- a/Code/template_meshVisualisierung_textur.c +++ b/Code/template_meshVisualisierung_textur.c @@ -155,8 +155,6 @@ void displaycloud(int modus) glDisable(GL_TEXTURE_2D); } - - /////////////////////////////////////////////////////////////////////////////////// if (modus > 0) { @@ -224,6 +222,19 @@ void display(void) GLfloat s_plane[] = { 0, 0, 1, 0 }; GLfloat t_plane[] = { 0, 1, 0, 0 }; + if (textureMode == 1) { // OBJECT LINEAR + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + + } else if (textureMode == 2) { // EYE LINEAR + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + + } + + glTexGenfv(GL_S, GL_OBJECT_PLANE, s_plane); + glTexGenfv(GL_T, GL_OBJECT_PLANE, t_plane); + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (lights == 1) { @@ -324,7 +335,7 @@ void init(void) glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); - glClearColor(0.99, 0.99, 0.99, 0.0); + glClearColor(0.99f, 0.99f, 0.99f, 0.0); glLoadIdentity(); xoff = 0.0; yoff = 0.0; @@ -339,14 +350,22 @@ void init(void) readBitmap(); // Texture wrap settings + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Filter settings + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Connecting lighting and texture + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // Initialize texture + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmapImage); // enable automatic texture generation + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); ////////////////////////////////////////////////////////////////////////////////////////////////////// }