Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6039 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

its getting late and i had an idea.. draw the scene then save the pixels as a texture, use this as a mirror. Has this been done before? it must''ve... this is what I tried but it didn''t work, how would you go about doing it? i have rgba pixel format, 640x480 unsigned int tex; void * data; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 640, 480,0, GL_RGBA, GL_INT, data); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 640, 480, GL_RGBA, GL_UNSIGNED_BYTE, data); glBindTexture(GL_TEXTURE_2D, tex); Am i not allocating space for the data, what type is it supposed to be in. anyways, time for sleep

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Yes, that''s a standard reflection technique.

Render your scene from the reflected viewpoint to a texture (or read the framebuffer back, as you did), clear the frambuffer, render your normal scene, and apply your reflection texture on the reflective surface. You can even modulate the reflection with a reflectivity map, or distort it (for water). It looks very nice.- AH

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!