Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Holland

Pages: [1]
1
Hey guys, still here. Wondering if anyone could help me get this mother running.

I was literally typing this when I found out what I was doing wrong. Anyway, I was using Vertex Buffer Objects, some OpenGL functions and stuff, when I found out that window.draw() needs resetGLStates to work correctly after OpenGL calls. So that's what I added, and now it works!

                g_FBO.setActive(); // Have to do this or it complains about the VBOs
                IdleGL(); // Idle function of GL
                DisplayGL(); // Render function
                g_Window->resetGLStates(); // Reset GL states
                g_Window->draw(sf::Sprite(g_FBO.getTexture())); // Draw texture as sprite.
                g_Window->display(); // Display window

Also, I created the FBO with a depth texture of course!

2
Graphics / Re: Sprite properties turn into 'unable to read memory'
« on: September 11, 2014, 08:08:38 pm »
0x00000004 means that the address of the class you're using is probably 0x00000000. This means that you're using a pointer and that you forgot to initialise this!

Look where you're using the instance CEditBox, check if it is using -> and that new is added.

This is probably what you're dealing with
CEditBox *t_EditBox;
t_EditBox->DoSomethingWithText();
This is what it needs to become
CEditBox *t_EditBox = new CEditBox();
t_EditBox->DoSomethingWithText();

//.. And when you're done using this editbox..
delete t_EditBox;
Or simply:
CEditBox t_EditBox = CEditBox();
t_EditBox.DoSomethingWithText();
Then deleting will be handled for you when you leave the scope

3
Ah, that did it! Now to figure out if it actually renders.. Getting a completely white screen.

4
Your edit gave me this error, which is the same for my code.
Quote
error C2664: 'void sf::RenderTarget::draw(const sf::Vertex *,unsigned int,sf::PrimitiveType,const sf::RenderStates &)' : cannot convert argument 2 from 'sf::Shader' to 'const sf::RenderStates &'
1>          Reason: cannot convert from 'sf::Shader' to 'const sf::RenderStates'

It's basically the example that I gave that doesn't work, there's little to no difference between
window.draw(sf::Sprite(m_FBO.getTexture()), m_ScreenShader);
and
sf::Sprite sprite(m_FBO.getTexture());
window.draw(sprite, m_ScreenShader);

Currently I am trying other stuff out, this seems to look like what I need, but need to test it out if it truly renders to m_FBO before m_FBO.display();. Haven't created any test objects.
void Application::Render()
{
        m_FBO.display();
        m_ScreenShader.setParameter("m_Texture", m_Texture);
        sf::Shader::bind(&m_ScreenShader);
        draw(sf::Sprite(m_FBO.getTexture()));

        display();     
        sf::Shader::bind(0);
}

5
Hey guys, does anyone have an example of a shader attached to the RenderTexture?

In the shader tutorial it says you can simply do

window.draw(sf::Sprite(m_FBO.getTexture()), m_ScreenShader);

But it's not in the API documentation, nor can I use it this way. I am new to SFML, so help would be awesome :)

Pages: [1]