Game Development Community

D3D glScissor bug in Release version of opengl2d3d

by Vitaliy · in Torque Game Builder · 01/24/2013 (12:01 am) · 7 replies

In the function static void QuakeUpdateViewport () in opengl2d3d.cc I came across a comment / / BUGBUG: if the viewport overlaps the scissor rect, then none of this Works. Is it possible to fix that Bug? If i use glScissor in the release version of opengl2d3d.dll, i have the viewport bug.

About the author

Recent Threads


#1
01/26/2013 (10:37 am)
What are you using glScissor for? There might be another way to accomplish what you're trying to do.
#2
01/28/2013 (5:07 am)
In the hidden object game i use glScissor in the window. Window has some animated object with rotation. Window appear with scaling. Game location and window has the same scenegraph. Above that window i have some inventory items and menu. Inventory items and window objects must be clipped.
#3
01/28/2013 (6:37 am)
Inventory and menu GUI objects support transparency - so if they're over something you can see through them....

If you're using sprite objects for these elements, well, oddly enough they also support transparency....

Maybe I'm missing something - can you post a screenshot or something to illustrate what you're talking about. It really sounds like you're trying to do something that you don't actually have to do.
#4
01/28/2013 (12:50 pm)
I may be misunderstanding, but there is this code (www.garagegames.com/community/forums/viewthread/81610) that can return you the color value at a pixel. (It may have limitations... check the whole thread.) You can then see if the pixel was transparent (or mostly transparent) to see if you should try to process the next object.

I remember that there once was a post or resource for ignoring objects if they were clicked on a transparent region (much like using a collision polygon), but I wasn't able to find it.
#5
01/28/2013 (6:09 pm)
Ah hah - yes, there was a resource on it once upon a time for filtering mouse events using the GUI object's image transparency.
#6
01/29/2013 (12:13 am)
Some screenshots:
Without clipping
s20.postimage.org/scryee8t5/001_00000.png

With clipping
s20.postimage.org/qxvfmse1l/001_000000.png
#7
01/29/2013 (12:33 am)
This can be accomplished much more simply (I think).

Put your border in the background as a GuiBitmapCtrl. Then place your t2dSceneWindow within the GuiBitmapCtrl. Something like:

new GuiControl(mainScreenGui) {
  new GuiBitmapCtrl(Frame) {
    position = "0 0";
    extent = "800 600";
    bitmap = "YourFrame.jpg";
    ...
  };
  new t2dSceneWindow(sceneWindow2D) {
    position = "25 25";
    extent = "750 550";
    ...
  };
}

When you put your scene into sceneWindow2D, it'll look clipped by the frame.