Problems with wxCanvas or ... ??

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Scorcher24
Earned some good credits
Earned some good credits
Posts: 128
Joined: Sat Sep 25, 2004 9:11 pm
Location: Nuremberg, Germany
Contact:

Problems with wxCanvas or ... ??

Post by Scorcher24 » Mon Aug 29, 2005 10:09 pm

Hi Folks !!

I have a problem with my ShaderDesigner.

I have converted from wxWindows-2.6.0 to 2.6.1 today.
When running my App in the Debugger, everything is ok. When I run it as standalone, the RenderObjects are not visible, expcept the Box. But this Object is too close to the camera, so you just see the front of the box, but no texture. The SphereRenderer is not visible @ all.
For the design of my App:

BaseApp <--> PluginAPI <-|-->RenderPlugins
|-->ToolPlugins

Here is the Code of my RenderPipeline:

Code: Select all

void CCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    if (!IsInitialized)return;

    int w = 0, h = 0;
    wxPaintDC dc(this);    

    GetClientSize(&w, &h);
    CFuelApi::SetCanvasSize(w,h);  

    // Clear Screen
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();    
    glPolygonMode(GL_FRONT_AND_BACK, PolyMode);

    // Call Plugin for Rendering, but bind Shader before.
    Bind();
        if (theParent) theParent->Render();
    Unbind();

    if (timer->IsRunning())
    {
        if (theParent)
        {
            wxString fpsMessage;
            fpsMessage.Printf("FPS: %i", Renderer.GetFPS());
            theParent->GetStatusBar()->SetStatusText(fpsMessage, 1);
        }

        Rotation == 360.0f ? Rotation = 0.0f : Rotation += 0.5f;
        CFuelApi::SetRotation(Rotation);
    }
    SwapBuffers();
}
This is some Code from the BoxRenderer-Plugin:

Code: Select all

bool CBox::Run()
{    
    static wxString texFile = GetAppPath() + "Textures/logo.tga";
    static dtVector4 vec4;    
    static dgLight light(GL_LIGHT1);

    glTranslatef(0.0f, 0.0f, -6.0f);
    glRotatef(GetRoation(), true, true, true);

    if (DrawTextured)
    {
        glBindTexture(GL_TEXTURE_2D, GetTexture());
        DrawTexBox();
        glBindTexture(GL_TEXTURE_2D, 0);
    }
    else
    {
        DrawColBox();
    }

    // Light
    vec4.Set(-9.0f, 2.0f, 1.0f, 0.0f); 
    light.SetPosition(vec4);        
    light.SetMaterial(GL_FRONT, GL_SHININESS, 128);
    light.SetMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, dgColor4(0.475f, 0.518f, 0.169f, 1.000f));
    light.SetExponent(128);
    light.SetColor( dgColor4( 1.0f, 1.0f, 1.0f, 1.0f),  // ambient
                    dgColor4( 1.0f, 1.0f, 1.0f, 1.0f),  // diffuse
                    dgColor4( 1.0f, 1.0f, 1.0f, 1.0f)); // specular    
    light.Enable();
    return true;
}
Perhaps you see something I don't. I am really confused.
What I have to say: I have used the modification for wxCanvas from here:
http://forums.wxwidgets.org/viewtopic.p ... highlight=
Thanks for helping.
rya.
Scorcher24
OS: Windows 7 Ultimate 64bit
IDE: VC++ 2008 Professional
WX: 2.9.2
My Projects

geon
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Tue Sep 07, 2004 4:10 pm
Location: Sweden, Uppsala

Post by geon » Thu Sep 01, 2005 10:08 am

How do you set up your projection matrix?

vasek
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Jul 27, 2005 2:52 pm
Location: Ostrava, Czech Republic
Contact:

Post by vasek » Thu Sep 01, 2005 2:02 pm

When I have troubles running app standalone (and under debugger is everything ok) I check copy constructors, assignment operators and virtual functions. E.g. omitted copy constructor is very usual problem if everything looks good in Debug mode and crashes/doesn't work in Release...

Scorcher24
Earned some good credits
Earned some good credits
Posts: 128
Joined: Sat Sep 25, 2004 9:11 pm
Location: Nuremberg, Germany
Contact:

Post by Scorcher24 » Thu Sep 01, 2005 3:40 pm

Ok, I have recognized that this only occurs in Addition with wxWindows 2.6.1.
When running/compiling the Application with 2.6.0 this error doesn't occur.
I can't say yet where the Error in wxWindows is, but I have checked my functions and I can't find the Error.

The Setup of my Projection:

Code: Select all

void CCanvas::OnSize( wxSizeEvent& size )
{
    int w = 1, h = 1;
    GetClientSize(&w, &h);

    SetCurrent();

    glViewport(0, 0, size.GetSize().x, size.GetSize().y);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    // Calculate The Aspect Ratio Of The Window
    gluPerspective( 45.0f, dgAspectRatio(size.GetSize().x, size.GetSize().y), 0.1f, 100.0f );    

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}
OnSize is called in the InitGL() function, called at the end of the constructor if CCanvas.

rya.
Scorcher24

ps.: I didn't receive an email, so excuse the late answer.
OS: Windows 7 Ultimate 64bit
IDE: VC++ 2008 Professional
WX: 2.9.2
My Projects

Post Reply