When I resize the window, the clip rectangle for glScissor should change.. but I don't exactly know how to change it so that it fits the rect resized by view used by sfml about doing that... Any help please?
helpful pictures?
normal(not resized)http://img845.imageshack.us/i/normalf.png
resized http://img203.imageshack.us/i/resizedb.png
[solved]glScissor and resizing window in sfml.
Moderator: Coders of Rage
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
[solved]glScissor and resizing window in sfml.
Last edited by adikid89 on Wed Apr 06, 2011 10:53 am, edited 1 time in total.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: glScissor and resizing window in sfml.
Can you not just call:adikid89 wrote:When I resize the window, the clip rectangle for glScissor should change.. but I don't exactly know how to change it so that it fits the rect resized by view used by sfml about doing that... Any help please?
helpful pictures?
normal(not resized)http://img845.imageshack.us/i/normalf.png
resized http://img203.imageshack.us/i/resizedb.png
glScissor(0,0,SCREEN_WIDTH, SCREEN_HEIGHT);
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
Re: glScissor and resizing window in sfml.
Why would I.. I guess I didn't explain properly. I use glScissor to not draw child widgets outside the rect of their parent. And the shape and position of the parent's rect changed when resized, and I need to compensate for that. I think I found a solution though: calculating the positions and size as a percentage of the window's size(for example the widget is at 1% width(x axis), 10%(y axis), its size is 15%(width) and 13%(height), and just convert that into the new window's size)
I think that should work..
I think that should work..
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: glScissor and resizing window in sfml.
Right I get what you're saying now. I thought you mean't the entire window. I guess your way could work if you take the widget/window ratio. I don't see any reason why that wouldn't work.
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
- adikid89
- Chaos Rift Cool Newbie
- Posts: 94
- Joined: Tue Apr 27, 2010 6:59 am
- Current Project: small tiny-mini projects
- Favorite Gaming Platforms: PC I guess...
- Programming Language of Choice: c++
glScissor and resizing window in sfml.
It didn't work...the positions were off..But I think I found the way this time . Because they resized based on the current view/window ratio... I'll uhm *calculate* the coords and size based on that. Still not quite sure how that'd go... but basically, in a window 800x600 with a view of 800x600, the ratio is 1, so the sizes and pos remain the same, in a window of 1000x600, the ratios are 1.25 and one.... so the position is offset by 1.25? and so is the width. At least I hope that's how it works
Edit: Using window/view ratio worked..
Edit: Using window/view ratio worked..
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================