Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//bind texture //set LightColor,Pos. ,Dif. glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glLightfv(GL_LIGHT1, GL_AMBIENT,LightColor); glLightiv(GL_LIGHT1, GL_POSITION,LightPosition); glLightfv(GL_LIGHT1, GL_DIFFUSE,LightDiffuse); //render 2d texture /* glBegin(GL_QUADS); glTexCoord2f... glColor4ub... glVertex3f... */ glDisable(GL_LIGHT0); glDisable(GL_LIGHT1); glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); |
Anonymous
unregistriert
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 |
glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glLightfv(GL_LIGHT1, GL_AMBIENT,LightColor); glLightiv(GL_LIGHT1, GL_POSITION,LightPosition); glLightfv(GL_LIGHT1, GL_DIFFUSE,LightDiffuse); |
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 |
float LightColor[] = { static_cast<float>(rgb[0])/255.0f, static_cast<float>(rgb[1])/255.0f, static_cast<float>(rgb[2])/255.0f, 1.0f }; int LightPosition[] = { x,y,z,1}; float LightDiffuse[] = {1.0f,1.0f,1.0f,1.0f,}; |
Anonymous
unregistriert
![]() |
C-/C++-Quelltext |
1 2 3 |
GLfloat LightAmbient[]= { 0.3f, 0.5f, 0.4f, 0.9f }; GLfloat LightDiffuse[]= { 0.9f, 0.9f, 1.0f, 1.0f }; GLfloat LightPosition[]= { 0.0f, 0.0f, 1.8f, 1.0f }; |
Anonymous
unregistriert
![]() |
C-/C++-Quelltext |
1 2 3 |
float LightColor[]= {static_cast <float> ((rgb[0]/rgb[0])-1), static_cast <float> ((rgb[1]/rgb[1])-1), static_cast <float> ((rgb[2]/rgb[2])-1)}; |
![]() |
C-/C++-Quelltext |
1 2 3 |
float LightColor[]= {static_cast <float> (rgb[0]/rgb[0]), static_cast <float> (rgb[1]/rgb[1]), static_cast <float> (rgb[2]/rgb[2])}; |
Anonymous
unregistriert
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 |
float color_1=rgb[0]/100; //Wenn 40, dann 0,4 float color_2=rgb[1]/100; //Wenn 100, dann 1 float color_3=rgb[2]/100; //Wenn 25, dann 0,25 float LightColor[]= {static_cast <float> (((rgb[0]/rgb[0])-1)+color_1), static_cast <float> (((rgb[1]/rgb[1])-1)+color_2), static_cast <float> (((rgb[2]/rgb[2])-1)+color_3)}; |
Zitat
Das geht so ohne weiteres nicht. Du willst von einer Fabrtabelle in die andere "switchen". Du kannst nicht einfach durch 255.0f teilen, denn was ist, wenn rgb[0]=45 ist?
Anonymous
unregistriert
Werbeanzeige