• 9
• 11
• 9
• 20
• 12

# pbuffer aspect ratio

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

## Recommended Posts

I am using a pbuffer as a means to generate water reflections. Everything works great except for that my aspect ratio on the pbuffer is 1:1 since it is a power of 2 which results in a black stripe on the top of the texture. What can i do to correct this? I have searched the forums and the closest case I can find to mine is this guys. He solves the same issue I am having, but does not specify how.

##### Share on other sites
ah, that'll be me then [grin]

Basicaly, after creating my pbuffer and then when I set up the state of the OpenGL context to match that of my main context I tell it that its size is whatever size the pbuffer is (say 1024*1024) and then, in my gluPerspective() call instead of setting the aspect ratio to the pbuffer width/pbuffer height I set it to the windows width/windows hight

ie, assuming a pbuffer of 1024*1024 and a screen rez of 1024*768
// Create pbuffer// switch its context to being the active one// then do all your various state setup and include thisglViewport(0,0,1024,1024);gluPerspective(45.0f,(1024.0f/768.0f),0.1f,100.0f);	// Calculate The Aspect Ratio Of The Window

tada, aspect ratio of pbuffer now matches that of the window.
Personaly, for my test program, I wrapped all my state setup in a function and just fed it height, width and aspect as varibles and used them in the code above where I need them.