Advertisement Jump to content
Sign in to follow this  
_WeirdCat_

Texture projection problem ;(

This topic is 1766 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);
}

Share this post


Link to post
Share on other sites
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

Edited by L. Spiro

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!