Horde3D
http://horde3d.org/forums/

[solved] render takes ~5 seconds to do 1 overlay?
http://horde3d.org/forums/viewtopic.php?f=3&t=705
Page 1 of 1

Author:  Saypen [ 18.04.2009, 07:38 ]
Post subject:  [solved] render takes ~5 seconds to do 1 overlay?

Horde3D::render takes ~5 seconds to render an empty scene graph with one fullscreen overlay...
I'm using a fairly large, ~1 meg png, i also tried bitmap but the same thing still happend...
Could the render be parsing the overlay image every frame?

heres the code:

Code:
//NOTE: Horde3D has been initialised previously
void CApp::start() //runs title screen
{
    //load gui
    ResHandle pipeRes = Horde3D::addResource( ResourceTypes::Pipeline, "pipelines/gui.pipeline.xml", 0 ); //pipeline
    ResHandle background = Horde3D::addResource( ResourceTypes::Material, "gui/background.material.xml", 0 ); //background

    Horde3DUtils::loadResourcesFromDisk("Media/");

    NodeHandle cam = Horde3D::addCameraNode( RootNode, "Camera", pipeRes );
    int refresh = 0; //so we dont update the gui every frame
    while ( !exit )
    {
        //check for events
        SDL_PollEvent(&event);
        if (event.type == SDL_QUIT) exit = true;

        if ( refresh == 0 ) //if its time to refresh
        {
            //update buttons TODO

            //clear
            Horde3D::clearOverlays();
           
            //draw
           
                                //top left             //bottom left //bottome right //top right
            Horde3D::showOverlay( 0.0f, 0.0f, 0, 1,     0, 1, 0, 0,    1, 1, 1, 0,     1, 0, 1, 1,  1, 1, 1, 1, background, 0 );


            //render
            Horde3D::render( cam );
            Horde3D::finalizeFrame();



            refresh = 100; //refresh every 20 frames
        }
        else refresh--; //reduse refresh

        SDL_GL_SwapBuffers(); //swap gl buffers

        //write h3d log
        Horde3DUtils::dumpMessages();

    }
    return;
}


P.S
overlays do get drawn during Horde3D::render right?

Author:  marciano [ 18.04.2009, 08:33 ]
Post subject:  Re: render takes ~5 seconds to do 1 overlay [empty scene graph]?

Your code looks ok. And of course horde does not reload the texture every frame (even that would not take 5 seconds ;)).

To me it seems like you have no hardware acceleration. What dimensions does your texture have? And could you paste the engine log?

Author:  Saypen [ 18.04.2009, 09:14 ]
Post subject:  Re: render takes ~5 seconds to do 1 overlay [empty scene graph]?

My graphics card is a 512 Radion X1300 so i've got hardware acceleration (all the demos work fine) so i dont think thats the problem
The image I am using is quite large, 1680 * 1050 though you would think that the renderer could cope with it
(i have resized the image to 1024 * 640 and the same happens)

The engine log seems completely normal:
Code:
0.000    Initializing OpenGL renderer using OGL '2.0.6847 WinXP Release' by 'ATI Technologies Inc.' on 'Radeon X1300/X1550 Series x86/SSE2'
0.000    Extension ARB_texture_non_power_of_two not supported
0.000    Extension EXT_framebuffer_multisample and/or EXT_framebuffer_blit not supported
0.015    Shadow map precision is limited to 16 bit
0.015    Adding Pipeline resource 'pipelines/gui.pipeline.xml'
0.015    Adding Material resource 'gui/background.material.xml'
0.015    Loading resource 'pipelines/gui.pipeline.xml'
0.015    Loading resource 'gui/background.material.xml'
0.015    Adding Shader resource 'shaders/overlay.shader'
0.015    Adding Texture resource 'gui/gui_temp.jpg'
0.015    Loading resource 'shaders/overlay.shader'
0.015    Adding Code resource 'shaders/overlay.shader:VS_OVERLAY'
0.015    Adding Code resource 'shaders/overlay.shader:FS_OVERLAY'
0.015    ---- C O M P I L I N G . S H A D E R . shaders/overlay.shader@OVERLAY[0] ----
0.015    Shader resource 'shaders/overlay.shader': ShaderLog: [Linking]

 Link successful. The GLSL vertex shader will run in hardware. The GLSL fragment shader will run in hardware.

0.015    Loading resource 'gui/gui_temp.jpg'
0.359    Adding Camera node 'Camera'
0.359    Adding Light node 'light'


Also here are the pipelines/shaders/materials I am using

Pipeline:
Code:
<!-- Simple Overlay Pipeline -->
<Pipeline>
   <CommandQueue>   
      <Stage id="Overlays">
         <ClearTarget colBuf0 = "true" col_R = "0.0" col_G = "0.0" col_B = "0.0" col_A = "1.0"/>
         <DrawOverlays context="OVERLAY" />
      </Stage>
   </CommandQueue>
</Pipeline>


Material:
Code:
<Material>   
   <Shader source="shaders/overlay.shader" />
   <Sampler name="albedoMap" map="gui/gui_temp.jpg" />
</Material>


Shader:
Code:
[[FX]]

<Sampler id="albedoMap" />

<Context id="OVERLAY">
   <Shaders vertex="VS_OVERLAY" fragment="FS_OVERLAY" />
   <RenderConfig writeDepth="false" blendMode="BLEND" />
</Context>

[[VS_OVERLAY]]

varying vec2 texCoords;

void main( void )
{
   texCoords = vec2( gl_MultiTexCoord0.s, -gl_MultiTexCoord0.t );
   gl_Position = gl_ProjectionMatrix * gl_Vertex;
}


[[FS_OVERLAY]]

uniform vec4 olayColor;
uniform sampler2D albedoMap;
varying vec2 texCoords;

void main( void )
{
   vec4 albedo = texture2D( albedoMap, texCoords );
   gl_FragColor = albedo;
   //gl_FragColor = vec4( 0.0, 0.0, 1.0, 1.0 );
}


Thanks for the help

Author:  Saypen [ 18.04.2009, 09:25 ]
Post subject:  Re: render takes ~5 seconds to do 1 overlay [empty scene graph]?

Never mind, i solved it by making the image a power of two... silly me...

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/