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 - dirk103

Pages: [1]
1
Graphics / Port app from 1.6 to 2.1. Now sf::Text isn't rendering
« on: December 03, 2013, 08:01:56 am »
Hey there,
I've just ported my fairly large application from SFML 1.6 to 2.1 and I've run into a bit of trouble when I go to render my sf::Text in a sf::RenderWindow.

==== Problem ====
- Under no circumstance does render_window->draw(my_sf_text); draw the text

==== Things i've checked/tried ====
- I have loaded a font and assigned it to my sf::Text
- I have verified that the font is loaded correctly by binding the sf::Texture of the font and pasted it on to a glBegin(GL_QUADS) region. This displays all the glyfs of the characters in my string.
- My GUI agent for rendering text is reporting the correct size of the font via .getLocalBounds()
- I have tried drawing some fresh text completely outside of all abstractions written in my program:
   // Setup
   sf::Text my_text;
   my_text.setFont(*Forms::default_font);
   my_text.setCharacterSize(24);
   my_text.setColor(sf::Color::Red);
   my_text.setStyle(sf::Text::Regular);
   my_text.setPosition(500, 100);
   my_text.setString("abcdefghijklnmopqrstuvwxyz1234567890 ");

   // In main loop
   // ...
   // Setup view
   App->pushGLStates();
   App->draw(my_text);
   App->popGLStates();
   // ...
   App->display();
- If I neglect to pushGLStates(), then it alters the state of opengl so that the rest of my graphics are corrupted, so I know that it's doing something.

==== Important notes (I think): ====
- I am making use of glew and initialize it after my RenderWindow has been created.


==== Question ====
- Are there any differences from 1.6 to 2.1 that I'm over looking that may lead to this?
- Is there some kind of conflict with glew in this case?

I'm sorry but I can't paste all relevant code as it's huge. If you want me to break down all of the code I'm using specifically for drawing fonts I can.


Thanks a bunch!

2
Network / got it!
« on: April 30, 2011, 07:20:37 am »
Okay, well I had to do a bit of digging, and I found out about the SocketHelper bit. Then I looked at the source and found Socket::Status. I'm just worried, in the documentation (sf::SocketHelper) it says:

"This class is meant for internal use only"  

Now in my method, I'm going to recv and wait until my status is anything but NotReady.

Is this reliable you think?
Thanks a bunch, oh and here's a teaser:

Code: [Select]

sf::Socket::Status ret;

sf::IPAddress host(IP);

/* Check to see if the supplied IP is valid */
if(!host.IsValid()) {
m_error = CERR_INVALID_HOST;
return false;
}

/* IP Looks good, so go ahead and connect */
//m_connection->SetBlocking(false);

ret = m_connection->Connect(port, host, 2.0f);
switch(ret) {
case sf::Socket::Error:
m_error = CERR_CONNECTION_TIMEOUT;
m_state = CLIENT_DISCONNECTED;
return false;
break;

case sf::Socket::Done:
m_error = CERR_OK;
m_state = CLIENT_CONNECTED;
return true;
break;
}

3
Network / Non-Blocking TCP Connect() - How to tell when it has connect
« on: April 30, 2011, 06:37:11 am »
Hey there!
I'd like my application not to freeze during a connect. How can I check to see if my application has made a successful connection?

If I:

while( ! socket->Connect(port, host, 0.0f) )
    cout << ".";

That seems to work, but that seems a little messy. Is there a nice interface to find out error codes for sockets that I can't find in the ref, or is this feature unavailable?

Thanks
Also. SFML is awesome, why was I using SDL before???

Pages: [1]