PDA

View Full Version : Panel resize problem in Borland C++ Builder



Javac
10-26-2003, 01:34 AM
This bug appears even in all AllanPetersen
(/www.allanpetersen.com/) tutorial demos which is NEHES tutorial
Borland C++ Builder version
I put TPanel on TForm and set the size to client,but after maximizing panel is not drawed in all area - 3/4 of left side is black.
Any solutions?

10-26-2003, 09:12 AM
According to what I know you need to call glViewport() in the resize event of the TForm. For example, something like this will work:

int w=Panel1->ClientWidth(),
h=Panel1->ClientHeight();
if(!h)h=1;
glViewport(0,0,w,h);
.
.
.

With that call, I believe that real (0,0,0) will correspond to (w/2,h/2) of the screen (panel, in this case).

Hope to have helped you!!!

Javac
10-26-2003, 08:35 PM
Thank You for answering!
The code You wrote is really the right thing to do ,but it's not working here.
There is smth undefined happening in Borlands Builder TPanel.I looked in Allan Petersen lessons - he is doing everything
perfect ,but the part of panel is still not repainted - left side is just staying black,
exactly as in my own demos.
I think that solution is just not to use panel and always draw on form?

Mazy
10-26-2003, 11:53 PM
Im using the TPanel alot ( in delphi not c++) and that works just fine, so it shouldnt be a problem with that. Where do you resize your viewport? in the forms resizeevent or the panels? Are you sure that you have an active rendercontext while you are doing that?