User forums > Using Code::Blocks

OpenGL wxSmith wxAui

(1/3) > >>

D_A_P:
I need some help, how to draw on wxGLCanvas(GLCanvas1) included as an wxAUI pane, created with code::blocks and wxSmith.

here some code:


--- Code: ---
void Frame::OnGLCanvas1Paint(wxPaintEvent& event)
{
  wxPaintDC dc(GLCanvas1);

  int w, h;
  GetClientSize(&w, &h);
  if(GLCanvas1->GetContext())   {
        GLCanvas1->SetCurrent();
        glViewport(0, 0, (GLint)w, (GLint)h);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(45.0, (float)w/(float)h, 0.1, 100.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
  }
  else
  {
    return;
  }
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glBegin(GL_POLYGON);
        glColor3f(1.0, 0.0, 0.0);
        glVertex2f(0.1, 0.1);
        glVertex2f(-0.1, 0.1);
        glVertex2f(-0.1, -0.1);
        glVertex2f(0.1, -0.1);
  glEnd();
  glFlush();
  GLCanvas2->SwapBuffers();
}

--- End code ---

oBFusCATed:
read this: http://wiki.wxwidgets.org/WxGLCanvas

D_A_P:

--- Quote from: oBFusCATed on January 04, 2011, 07:17:58 pm ---read this: http://wiki.wxwidgets.org/WxGLCanvas

--- End quote ---

I can't find some help for wxSmith in this wiki.

seb_seb0:
To be honest, I do not have the time to look at your code.
You forgot to tell us one major thing: which version of wxWidgets you are using (2.8.11 or 2.9.x).
This has some importance because the API changed.
You forgot also to tell us what went wrong.

In any case, I attach an example (without wxAUI). It is a NeHe sample, that I have ported to wxWidgets 2.9.x

I am also using a patched version of the wxGLCanvas in wxSmith (due to the aboved mentioned changes in the API). I attach the Code::Blocks plugin to it. It works for me on Windows Vista, with the last nightly.

Good luck !

Sebastien

seb_seb0:
The same sample, with wxAUI + wxWidgets 2.9.1

Navigation

[0] Message Index

[#] Next page

Go to full version