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

Author Topic: 2 render windows?  (Read 11152 times)

0 Members and 1 Guest are viewing this topic.

Henrik.Flink

  • Newbie
  • *
  • Posts: 21
    • View Profile
2 render windows?
« on: January 21, 2008, 11:24:08 pm »
I think i want to use 2 render windows to blit things at different places in the window, dont even know if it's possible or if there is any other solution? But the thing is that i want 1 window but i want like one render window that blits from lets say (0, 0) - (100, 100) and one that blits from (100,0) - (200,100).
So i can call render on a sprite with coordinates (10,10) on the second rederwindow so its "global" position will be (110,10).

I have faked this so it works well by offesetting the coordinates when i call render but i wonder if there is any better solution?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
2 render windows?
« Reply #1 on: January 22, 2008, 02:33:25 am »
There is currently no virtual rendering window in SFML, you have to fake it.

The easiest way is to use views, instead of offseting the sprites each time you draw them.

Then you would still need to do some clipping, to make sure nothing goes outside your virtual window, but that's for the next version (you can implement it using OpenGL scissor rect if you really need it) ;)
Laurent Gomila - SFML developer

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
2 render windows?
« Reply #2 on: January 22, 2008, 08:58:42 am »
Using the stencilbuffer should be faster. Just draw a quad using the size of the window and set stencil functions to some sane values(if you dont want subwindows compare against 1 and set the function to add) remember to clean stencilbuffer.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
2 render windows?
« Reply #3 on: January 22, 2008, 09:58:51 am »
Stencil faster than scissor test ? Are you sure of that ?

Scissor is just an optimized stencil test, without reference value and comparison function. I can't see any reason it could be slower ;)
Laurent Gomila - SFML developer

Henrik.Flink

  • Newbie
  • *
  • Posts: 21
    • View Profile
2 render windows?
« Reply #4 on: January 22, 2008, 11:58:06 am »
I dont think i will have to cut anuthing cus it's fore i tilebased game so nothing will ever be outside the tile map if it's that you mean...

Henrik.Flink

  • Newbie
  • *
  • Posts: 21
    • View Profile
2 render windows?
« Reply #5 on: January 22, 2008, 11:33:38 pm »
I was just testing with the views, and the views streches over the whole window which dont really help me att all. I dont think i really get how to do it with the views, i have one view covering the first half of the screen and the other view covering the other half, then i change view just before i do the render call and it seems that it streches over the whole screen which insn't the result i was after(orly?)  :?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
2 render windows?
« Reply #6 on: January 23, 2008, 02:23:44 am »
Hum... yes, sorry, it can't work directly with views. Forget what I said for the moment, the easiest solution is still to offset the sprites manually.
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
2 render windows?
« Reply #7 on: February 04, 2008, 07:34:22 pm »
I'm not entirely sure if I understood the problem correctly, but if you want two virtual windows inside a single real window, why don't you simply use glViewport?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
2 render windows?
« Reply #8 on: February 05, 2008, 02:15:40 am »
SFML uses its own viewport, so you can't just use a custom one and be able to draw in it with SFML.
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
2 render windows?
« Reply #9 on: February 05, 2008, 11:15:18 am »
Ah, I didn't know that (I mainly use the Window+System packages).