OpenGl updates (still gives warnings..)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-10-04 19:54:25 +00:00
parent 5e0201eaa1
commit 1d61ebaca1
2 changed files with 25 additions and 30 deletions

View File

@ -128,6 +128,18 @@ wxPalette wxGLContext::CreateDefaultPalette()
return wxNullPalette;
}
//-----------------------------------------------------------------------------
// "realize" from m_wxwindow
//-----------------------------------------------------------------------------
static gint
gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
{
win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, win->m_glContext );
return FALSE;
}
//---------------------------------------------------------------------------
// wxGlCanvas
//---------------------------------------------------------------------------
@ -166,21 +178,13 @@ bool wxGLCanvas::Create( wxWindow *parent,
int *attribList,
const wxPalette& palette)
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( _T("wxGLCanvas creation failed") );
return FALSE;
}
m_glContext = (wxGLContext*)shared; // const_cast
if (!attribList)
{
int data[] = { GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1, /* use largest available depth buffer */
GLX_DEPTH_SIZE, 1, // use largest available depth buffer
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
@ -225,37 +229,28 @@ bool wxGLCanvas::Create( wxWindow *parent,
gtk_widget_push_colormap( colormap );
gtk_widget_push_visual( visual );
wxScrolledWindow::Create( parent, id, pos, size, style, name );
m_glWidget = m_wxwindow;
m_glWidget = gtk_myfixed_new();
m_widget = m_glWidget;
gtk_signal_connect( GTK_OBJECT(m_glWidget), "realize",
GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this );
gtk_widget_pop_visual();
gtk_widget_pop_colormap();
m_parent->DoAddChild( this );
/* must be realized for OpenGl output */
gtk_widget_realize( m_glWidget );
m_glContext = new wxGLContext( TRUE, this, palette, shared );
XFree( g_vi );
g_vi = (XVisualInfo*) NULL;
/* we pretend to have a m_wxwindow so that PostCreation hooks
up the events for expose and draw */
m_wxwindow = m_glWidget;
PostCreation();
Show( TRUE );
return TRUE;
}
wxGLCanvas::~wxGLCanvas()
{
if (m_glContext) delete m_glContext;
m_wxwindow = (GtkWidget*) NULL;
}
void wxGLCanvas::SwapBuffers()
@ -292,10 +287,10 @@ void wxGLCanvas::SetColour( const char *colour )
GtkWidget *wxGLCanvas::GetConnectWidget()
{
return m_glWidget;
return m_wxwindow;
}
bool wxGLCanvas::IsOwnGtkWindow( GdkWindow *window )
{
return (window == m_glWidget->window);
return (window == m_wxwindow->window);
}

View File

@ -21,7 +21,7 @@ Penguin: penguin.o trackball.o lw.o glcanvas.o
`wx-config --libs` -lMesaGL -lMesaGLU
penguin.o: penguin.cpp
$(CPP) `wx-config --cflags` -I../../gtk -c penguin.cpp
$(CPP) `wx-config --cflags` -g -I../../gtk -c penguin.cpp
lw.o: lw.cpp
$(CPP) `wx-config --cflags` -I../../gtk -c lw.cpp
@ -30,7 +30,7 @@ trackball.o: trackball.c
$(CC) `wx-config --cflags` -I../../gtk -c trackball.c
glcanvas.o: ../../gtk/glcanvas.cpp
$(CPP) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c ../../gtk/glcanvas.cpp
$(CPP) `wx-config --cflags` `gtk-config --cflags` -g -I../../gtk -c ../../gtk/glcanvas.cpp
clean:
rm -f *.o Penguin