|
9 | 9 | #include <Gwork/PlatformTypes.h>
|
10 | 10 |
|
11 | 11 | #include <GLFW/glfw3.h>
|
12 |
| -//#include <GL/glew.h> |
13 | 12 | #include <math.h>
|
14 | 13 |
|
15 | 14 | //#define STBI_ASSERT(x) // comment in for no asserts
|
@@ -83,7 +82,7 @@ namespace Gwk
|
83 | 82 |
|
84 | 83 | // OpenGL origin is bottom-left. Gwork origin is top-left.
|
85 | 84 | m_vertices[ m_vertNum ].x = float(x);
|
86 |
| - m_vertices[ m_vertNum ].y = m_viewRect.h - float(y); |
| 85 | + m_vertices[ m_vertNum ].y = float(m_viewRect.h - y); |
87 | 86 | m_vertices[ m_vertNum ].u = u;
|
88 | 87 | m_vertices[ m_vertNum ].v = v;
|
89 | 88 | m_vertices[ m_vertNum ].r = m_color.r;
|
@@ -122,22 +121,22 @@ namespace Gwk
|
122 | 121 | void OpenGL::StartClip()
|
123 | 122 | {
|
124 | 123 | Flush();
|
125 |
| -// Gwk::Rect rect = ClipRegion(); |
126 |
| -// // OpenGL's coords are from the bottom left |
127 |
| -// // so we need to translate them here. |
128 |
| -// { |
129 |
| -// GLint view[4]; |
130 |
| -// glGetIntegerv(GL_VIEWPORT, &view[0]); |
131 |
| -// rect.y = view[3] - (rect.y + rect.h); |
132 |
| -// } |
133 |
| -// glScissor(rect.x*Scale(), rect.y*Scale(), rect.w*Scale(), rect.h*Scale()); |
134 |
| -// glEnable(GL_SCISSOR_TEST); |
| 124 | + Gwk::Rect rect = ClipRegion(); |
| 125 | + // OpenGL's coords are from the bottom left |
| 126 | + // so we need to translate them here. |
| 127 | + { |
| 128 | + GLint view[4]; |
| 129 | + glGetIntegerv(GL_VIEWPORT, &view[0]); |
| 130 | + rect.y = view[3] - (rect.y + rect.h); |
| 131 | + } |
| 132 | + glScissor(rect.x*Scale(), rect.y*Scale(), rect.w*Scale(), rect.h*Scale()); |
| 133 | + glEnable(GL_SCISSOR_TEST); |
135 | 134 | }
|
136 | 135 |
|
137 | 136 | void OpenGL::EndClip()
|
138 | 137 | {
|
139 | 138 | Flush();
|
140 |
| -// glDisable(GL_SCISSOR_TEST); |
| 139 | + glDisable(GL_SCISSOR_TEST); |
141 | 140 | }
|
142 | 141 |
|
143 | 142 | void OpenGL::DrawTexturedRect(Gwk::Texture* texture, Gwk::Rect rect,
|
@@ -196,11 +195,7 @@ namespace Gwk
|
196 | 195 | glBindTexture(GL_TEXTURE_2D, *pglTexture);
|
197 | 196 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
198 | 197 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
199 |
| -//#ifdef FREEIMAGE_BIGENDIAN |
200 | 198 | GLenum format = GL_RGBA;
|
201 |
| -//#else |
202 |
| -// GLenum format = GL_BGRA; |
203 |
| -//#endif |
204 | 199 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, format,
|
205 | 200 | GL_UNSIGNED_BYTE, (const GLvoid*)data);
|
206 | 201 |
|
|
0 commit comments