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

Pages: 1 [2]
16
Graphics / Re: Drawing vertexarrays always start from 0,0
« on: January 05, 2013, 03:11:55 am »
That did the trick, Thanks!  :D

17
Graphics / Re: Drawing vertexarrays always start from 0,0
« on: January 05, 2013, 03:02:26 am »
The box is just an simplified example, any arbitrary shape drawn this way will start off from (0,0).

18
Graphics / Re: Drawing vertexarrays always start from 0,0
« on: January 05, 2013, 02:57:09 am »

   sf::VertexArray lines(sf::LinesStrip, m_Verts.size()+1);
   std::vector<sf::Vector2<float> >::const_iterator it = m_Verts.begin();
   for(;it!=m_Verts.end();++it) {
      lines.append(sf::Vertex(*it, sf::Color(255,255,255,255)));
   }
   lines.append(sf::Vertex(m_Verts[0], sf::Color(255,255,255,255)));
   target.draw(lines);

 

and m_Verts is fed like this


   m_Verts.push_back(sf::Vector2f(10,10));
   m_Verts.push_back(sf::Vector2f(110,10));
   m_Verts.push_back(sf::Vector2f(110,110));
   m_Verts.push_back(sf::Vector2f(10,110));

 

This example out of context may seem like a detour though ;)

19
Graphics / Drawing vertexarrays always start from 0,0
« on: January 05, 2013, 02:49:35 am »
Hi,
I don't know if I am missing something but when I try to draw lines using a sf::VertexArray it always starts drawing from (0,0).
So let's say I choose to draw a box with theese coords:

(10,10)
(110,10)
(110,110)
(10,110)

I have attached an image of the result.
Running SFML2.0 on a LinuxBox.

Is this the desired result or a bug? And is there a workaround?



[attachment deleted by admin]

20
Window / Re: Resizing (Qt) does not work
« on: April 15, 2012, 10:17:26 am »
   
Code: [Select]
    sf::View view = sf::View(sf::FloatRect(0,0,w,h));
    float a = h/(initialHeight*2);
    view.SetViewport(sf::FloatRect(0,(-a+1),w/initialWidth,h/initialHeight));
    sf::RenderWindow::SetView(view);

Where initialSizes are the initial-size of the wxPanel, as specified in ctor.
Please, give feedback to this solution, since the "a" was created empirically. Works like a charm though.  ;)

21
Window / Re: Resizing (Qt) does not work
« on: April 15, 2012, 09:36:21 am »
Thanks,

I followed your lead about the viewport. And It is possible, atleast in wxWidget, to resize to PanelSize(wxWidget) by updating both the view and viewport, to get rid of the clipping that is restricted to initial size of widget. So there is no need to call Create() on resize-handler, which is inefficient and fails for wxWidgets. Perhaps this is also true for Qt ?

Now when I resize the window / panel, I maintain coord(0,0) in top/left corner and maintain pixelsize (no streching).


22
Window / Re: Resizing (Qt) does not work
« on: April 12, 2012, 11:08:23 pm »
Viewport of the sf::Renderwindow?

23
Window / Re: Resizing (Qt) does not work
« on: April 12, 2012, 12:17:54 pm »
Hi,

Seems like re-creating the context/window seems to be the only solution for this. I have the same problem with running SFML-context in a wxWidget-Panel. But there seems to be a bug...

When I call upon sf::Window::Create( getSystemHandle() )  in the resizeHandler, I get this funny graphical artifact. (see attachment )


...where it seems like all textures are random-memory.
Please, need help figuring out a solution for this. Do I have to reload every texture?

Btw, using SFML2.0/ArchLinux/ATI


Pages: 1 [2]