Applied pieterpan's patch to disallow window to get too small.
#1542 is not fixed yet, as the crash happened in Mesa Software Renderer add-on first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22573 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b8b20fac4d
commit
0795ca4a8e
@ -71,8 +71,16 @@ SampleGLApp::SampleGLApp()
|
|||||||
|
|
||||||
|
|
||||||
SampleGLWindow::SampleGLWindow(BRect frame, uint32 type)
|
SampleGLWindow::SampleGLWindow(BRect frame, uint32 type)
|
||||||
: BDirectWindow(frame, "OpenGL Test", B_TITLED_WINDOW, 0)
|
: BDirectWindow(frame, "GLDirectMode", B_TITLED_WINDOW, 0)
|
||||||
{
|
{
|
||||||
|
float minWidth = 0.0f;
|
||||||
|
float maxWidth = 0.0f;
|
||||||
|
float minHeight = 0.0f;
|
||||||
|
float maxHeight = 0.0f;
|
||||||
|
|
||||||
|
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||||
|
SetSizeLimits(50.0f, maxWidth, 50.0f, maxHeight);
|
||||||
|
|
||||||
BRect r = Bounds();
|
BRect r = Bounds();
|
||||||
|
|
||||||
r.InsetBy(10, 10);
|
r.InsetBy(10, 10);
|
||||||
@ -208,10 +216,12 @@ void SampleGLView::gDraw(float rotation)
|
|||||||
void SampleGLView::gReshape(int width, int height)
|
void SampleGLView::gReshape(int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
if (height) { // Avoid Divide By Zero error...
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluPerspective(45, width / (float) height, 1, 500);
|
gluPerspective(45, width / (float) height, 1, 500);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user