patch from Dimitri fixing a few memory leaks and unTABbing the sources
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -279,8 +279,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
||||
wxGLCanvas::OnSize(event);
|
||||
|
||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
#ifndef __WXMOTIF__
|
||||
if (GetContext())
|
||||
#endif
|
||||
@@ -385,7 +385,7 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event )
|
||||
Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime );
|
||||
|
||||
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
||||
m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac...
|
||||
m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac...
|
||||
#else
|
||||
m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct;
|
||||
#endif
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CUBE_H_
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -91,8 +91,8 @@ static void read_surface( char *filename )
|
||||
numverts = 0;
|
||||
while (!feof(f) && numverts<MAXVERTS) {
|
||||
fscanf( f, "%f %f %f %f %f %f",
|
||||
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
|
||||
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
|
||||
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
|
||||
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
|
||||
numverts++;
|
||||
}
|
||||
numverts--;
|
||||
@@ -263,12 +263,12 @@ bool MyApp::OnInit(void)
|
||||
int *gl_attrib = NULL;
|
||||
#else
|
||||
int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1,
|
||||
WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
|
||||
WX_GL_DOUBLEBUFFER,
|
||||
WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
|
||||
WX_GL_DOUBLEBUFFER,
|
||||
# ifdef __WXMAC__
|
||||
GL_NONE };
|
||||
GL_NONE };
|
||||
# else
|
||||
None };
|
||||
None };
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -366,13 +366,13 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
||||
wxGLCanvas::OnSize(event);
|
||||
|
||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
#ifndef __WXMOTIF__
|
||||
if (GetContext())
|
||||
#endif
|
||||
{
|
||||
SetCurrent();
|
||||
SetCurrent();
|
||||
glViewport(0, 0, (GLint) w, (GLint) h);
|
||||
}
|
||||
}
|
||||
@@ -381,39 +381,39 @@ void TestGLCanvas::OnChar(wxKeyEvent& event)
|
||||
{
|
||||
switch(event.KeyCode()) {
|
||||
case WXK_ESCAPE:
|
||||
exit(0);
|
||||
exit(0);
|
||||
case WXK_LEFT:
|
||||
yrot -= 15.0;
|
||||
break;
|
||||
yrot -= 15.0;
|
||||
break;
|
||||
case WXK_RIGHT:
|
||||
yrot += 15.0;
|
||||
break;
|
||||
yrot += 15.0;
|
||||
break;
|
||||
case WXK_UP:
|
||||
xrot += 15.0;
|
||||
break;
|
||||
xrot += 15.0;
|
||||
break;
|
||||
case WXK_DOWN:
|
||||
xrot -= 15.0;
|
||||
break;
|
||||
xrot -= 15.0;
|
||||
break;
|
||||
case 's': case 'S':
|
||||
smooth = !smooth;
|
||||
if (smooth) {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
} else {
|
||||
glShadeModel(GL_FLAT);
|
||||
}
|
||||
break;
|
||||
smooth = !smooth;
|
||||
if (smooth) {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
} else {
|
||||
glShadeModel(GL_FLAT);
|
||||
}
|
||||
break;
|
||||
case 'l': case 'L':
|
||||
lighting = !lighting;
|
||||
if (lighting) {
|
||||
glEnable(GL_LIGHTING);
|
||||
} else {
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
break;
|
||||
lighting = !lighting;
|
||||
if (lighting) {
|
||||
glEnable(GL_LIGHTING);
|
||||
} else {
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
event.Skip();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,17 +427,17 @@ void TestGLCanvas::OnMouseEvent(wxMouseEvent& event)
|
||||
|
||||
//printf("%f %f %d\n", event.GetX(), event.GetY(), (int)event.LeftIsDown());
|
||||
if(event.LeftIsDown()) {
|
||||
if(!dragging) {
|
||||
dragging = 1;
|
||||
} else {
|
||||
yrot += (event.GetX() - last_x)*1.0;
|
||||
xrot += (event.GetY() - last_y)*1.0;
|
||||
Refresh(FALSE);
|
||||
}
|
||||
last_x = event.GetX();
|
||||
last_y = event.GetY();
|
||||
if(!dragging) {
|
||||
dragging = 1;
|
||||
} else {
|
||||
yrot += (event.GetX() - last_x)*1.0;
|
||||
xrot += (event.GetY() - last_y)*1.0;
|
||||
Refresh(FALSE);
|
||||
}
|
||||
last_x = event.GetX();
|
||||
last_y = event.GetY();
|
||||
} else
|
||||
dragging = 0;
|
||||
dragging = 0;
|
||||
}
|
||||
|
||||
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_ISOSURF_H_
|
||||
|
@@ -45,9 +45,9 @@
|
||||
#endif
|
||||
|
||||
#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
|
||||
(((wxUint32)(b))<<16)| \
|
||||
(((wxUint32)(c))<< 8)| \
|
||||
(((wxUint32)(d)) ))
|
||||
(((wxUint32)(b))<<16)| \
|
||||
(((wxUint32)(c))<< 8)| \
|
||||
(((wxUint32)(d)) ))
|
||||
|
||||
#define ID_FORM MK_ID('F','O','R','M')
|
||||
#define ID_LWOB MK_ID('L','W','O','B')
|
||||
@@ -212,9 +212,9 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
||||
det_cnt = read_short(f);
|
||||
nbytes -= 2;
|
||||
while (det_cnt-- > 0) {
|
||||
int cnt = read_short(f);
|
||||
fseek(f, cnt*2+2, SEEK_CUR);
|
||||
nbytes -= cnt*2+2;
|
||||
int cnt = read_short(f);
|
||||
fseek(f, cnt*2+2, SEEK_CUR);
|
||||
nbytes -= cnt*2+2;
|
||||
}
|
||||
}
|
||||
face->material -= 1;
|
||||
@@ -380,13 +380,13 @@ void lw_object_show(const lwObject *lw_object)
|
||||
prev_index_cnt = face->index_cnt;
|
||||
switch (face->index_cnt) {
|
||||
case 3:
|
||||
glBegin(GL_TRIANGLES);
|
||||
break;
|
||||
glBegin(GL_TRIANGLES);
|
||||
break;
|
||||
case 4:
|
||||
glBegin(GL_QUADS);
|
||||
break;
|
||||
glBegin(GL_QUADS);
|
||||
break;
|
||||
default:
|
||||
glBegin(GL_POLYGON);
|
||||
glBegin(GL_POLYGON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,8 +394,8 @@ void lw_object_show(const lwObject *lw_object)
|
||||
if (prev_material != face->material) {
|
||||
prev_material = face->material;
|
||||
glColor3f(lw_object->material[face->material].r,
|
||||
lw_object->material[face->material].g,
|
||||
lw_object->material[face->material].b);
|
||||
lw_object->material[face->material].g,
|
||||
lw_object->material[face->material].b);
|
||||
}
|
||||
|
||||
/* update normal if necessary */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -159,8 +159,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
||||
wxGLCanvas::OnSize(event);
|
||||
|
||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
#ifndef __WXMOTIF__
|
||||
if (GetContext())
|
||||
#endif
|
||||
@@ -203,17 +203,17 @@ void TestGLCanvas::OnMouse( wxMouseEvent& event )
|
||||
/* drag in progress, simulate trackball */
|
||||
float spin_quat[4];
|
||||
trackball(spin_quat,
|
||||
(2.0*info.beginx - sz.x) / sz.x,
|
||||
( sz.y - 2.0*info.beginy) / sz.y,
|
||||
( 2.0*event.GetX() - sz.x) / sz.x,
|
||||
( sz.y - 2.0*event.GetY()) / sz.y);
|
||||
|
||||
(2.0*info.beginx - sz.x) / sz.x,
|
||||
( sz.y - 2.0*info.beginy) / sz.y,
|
||||
( 2.0*event.GetX() - sz.x) / sz.x,
|
||||
( sz.y - 2.0*event.GetY()) / sz.y);
|
||||
|
||||
add_quats( spin_quat, info.quat, info.quat );
|
||||
|
||||
|
||||
/* orientation has changed, redraw mesh */
|
||||
Refresh(FALSE);
|
||||
Refresh(FALSE);
|
||||
}
|
||||
|
||||
|
||||
info.beginx = event.GetX();
|
||||
info.beginy = event.GetY();
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_PENGUIN_H_
|
||||
|
Reference in New Issue
Block a user