Texture projection problem ;(

Started by
1 comment, last by _WeirdCat_ 10 years, 1 month ago

Hi, i have a strange issue:

Year ago code worked like:

bh.jpg

And now it looks like:

crap.jpg

I have no idea what i have changed, maybe someone will see the unseen.

And heres code:


void __fastcall TGLLight::DrawProjection()
{
glColor3f(1,1,1); 
 glEnable(GL_BLEND);


  glClear(GL_COLOR_BUFFER_BIT);
   glClear(GL_DEPTH_BUFFER_BIT);   


glBlendFunc(GL_ONE, GL_ZERO);
//  glBindTexture(GL_TEXTURE_2D, ter);


glMatrixMode(GL_MODELVIEW);

glLoadIdentity();                                      

 gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
 campointofview.x, campointofview.y, campointofview.z,
 0.0f, 1.0f, 0.0f);



glEnable(GL_LIGHTING);
glEnable( GL_COLOR_MATERIAL );
visible(0,true);
SET_UP_LIGHT(0, lightPosition,sundiffa,sunamba );

SCENE->col->SCENE_MODELS[0]->DrawSimpleModel();
visible(0,false);
glDisable( GL_COLOR_MATERIAL );
glDisable(GL_LIGHTING);




glEnable(GL_TEXTURE_2D);



  glBlendFunc(GL_DST_COLOR, GL_ONE);
  glBindTexture(GL_TEXTURE_2D, ProjectedTexture);




  glEnable(GL_TEXTURE_GEN_S);
  glEnable(GL_TEXTURE_GEN_T);
  glEnable(GL_TEXTURE_GEN_R);
  glEnable(GL_TEXTURE_GEN_Q);




  
  glMatrixMode(GL_TEXTURE);
  glLoadIdentity();
  glTranslatef(0.5f, 0.5f, 0.0f);
  glScalef(0.5f, 0.5f, 1.0f);
//  gluPerspectiveA(90.0f, 1.330f, 0.010f /*1000.0f*/,  1000.0f);
gluPerspective(90.0f, 1.330f, 0.010f /*1000.0f*/,  1000.0f);


 gluLookAt(lightPosition.x, lightPosition.y, lightPosition.z,
 pointlight.x, pointlight.y, pointlight.z,
 0.0f, 1.0f, 0.0f);


 glMatrixMode(GL_MODELVIEW);



SCENE->col->SCENE_MODELS[0]->DrawSimpleModel();




  glDisable(GL_TEXTURE_GEN_S);
  glDisable(GL_TEXTURE_GEN_T);
  glDisable(GL_TEXTURE_GEN_R);
  glDisable(GL_TEXTURE_GEN_Q);
  glMatrixMode(GL_TEXTURE);
  glLoadIdentity();



 glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
}

Advertisement

Considering it is partly a texture problem I would look carefully at lines such as “// glBindTexture(GL_TEXTURE_2D, ter);”, especially since terrain is one of the missing textures.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

I have a bug somewhere in rendering pipeline, i just executed this code at the beggining of glDraw() and it works as intended.

Thx for help ;p

This topic is closed to new replies.

Advertisement