Skip to content

Commit

Permalink
libgui|libappfw: Renamed the de::gl namespace to de::gfx
Browse files Browse the repository at this point in the history
de::gl may clash with glbinding's gl namespace.
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent fa89e98 commit b43d610
Show file tree
Hide file tree
Showing 27 changed files with 293 additions and 273 deletions.
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/basewindow.cpp
Expand Up @@ -52,7 +52,7 @@ DE_PIMPL(BaseWindow)
// The framework widgets expect basic alpha blending.
GLState::current()
.setBlend(true)
.setBlendFunc(gl::SrcAlpha, gl::OneMinusSrcAlpha);
.setBlendFunc(gfx::SrcAlpha, gfx::OneMinusSrcAlpha);
}

void keyEvent(KeyEvent const &ev)
Expand Down
6 changes: 3 additions & 3 deletions doomsday/libs/appfw/src/guiwidget.cpp
Expand Up @@ -190,18 +190,18 @@ DE_PIMPL(GuiWidget)
// Multisampling is disabled in the blurs for now.
blur->fb[i].reset(new GLTextureFramebuffer(Image::RGB_888, blur->size, 1));
blur->fb[i]->glInit();
blur->fb[i]->colorTexture().setFilter(gl::Linear, gl::Linear, gl::MipNone);
blur->fb[i]->colorTexture().setFilter(gfx::Linear, gfx::Linear, gfx::MipNone);
}

// Set up the drawble.
DefaultVertexBuf *buf = new DefaultVertexBuf;
blur->drawable.addBuffer(buf);
buf->setVertices(gl::TriangleStrip,
buf->setVertices(gfx::TriangleStrip,
DefaultVertexBuf::Builder().makeQuad(
Rectanglef(0, 0, 1, 1),
Vec4f(1, 1, 1, 1),
Rectanglef(0, 0, 1, 1)),
gl::Static);
gfx::Static);

blur->uBlurStep = Vec2f(1.f / float(blur->size.x),
1.f / float(blur->size.y));
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/painter.cpp
Expand Up @@ -40,7 +40,7 @@ DE_PIMPL(Painter), public Asset
: Base(i)
, vertexBuf(GuiVertex::formatSpec())
{
vertexBuf.setUsage(gl::Dynamic);
vertexBuf.setUsage(gfx::Dynamic);
vertexBuf.setMaxElementCount(2048);
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/vr/oculusrift.cpp
Expand Up @@ -182,7 +182,7 @@ DE_PIMPL(OculusRift)
uint const w = framebuffer().size().x;
uint const h = framebuffer().size().y;

framebuffer().colorTexture().setFilter(gl::Linear, gl::Linear, gl::MipNone);
framebuffer().colorTexture().setFilter(gfx::Linear, gfx::Linear, gfx::MipNone);
framebuffer().colorTexture().glApplyParameters();

LOG_GL_VERBOSE("Framebuffer size: ") << framebuffer().size().asText();
Expand Down
18 changes: 9 additions & 9 deletions doomsday/libs/appfw/src/vrwindowtransform.cpp
Expand Up @@ -171,9 +171,9 @@ DE_PIMPL(VRWindowTransform)
"out_FragColor = ((int(gl_FragCoord.y) & 1) == 0 ? texture(uTex, vUV) :"
"texture(uTex2, vUV)); }"))
<< rowInterUniformTex << rowInterUniformTex2;
buf->setVertices(gl::TriangleStrip,
buf->setVertices(gfx::TriangleStrip,
VBuf::Builder().makeQuad(Rectanglef(-1, -1, 2, 2), Rectanglef(0, 0, 1, 1)),
gl::Static);
gfx::Static);
}

void draw()
Expand Down Expand Up @@ -254,23 +254,23 @@ DE_PIMPL(VRWindowTransform)
case VRConfig::GreenMagenta:
// Left eye view
vrCfg.setCurrentEye(VRConfig::LeftEye);
GLState::push().setColorMask(gl::WriteGreen | gl::WriteAlpha); // Left eye view green
GLState::push().setColorMask(gfx::WriteGreen | gfx::WriteAlpha); // Left eye view green
drawContent();
// Right eye view
vrCfg.setCurrentEye(VRConfig::RightEye);
GLState::current().setColorMask(gl::WriteRed | gl::WriteBlue | gl::WriteAlpha); // Right eye view magenta
GLState::current().setColorMask(gfx::WriteRed | gfx::WriteBlue | gfx::WriteAlpha); // Right eye view magenta
drawContent();
GLState::pop();
break;

case VRConfig::RedCyan:
// Left eye view
vrCfg.setCurrentEye(VRConfig::LeftEye);
GLState::push().setColorMask(gl::WriteRed | gl::WriteAlpha); // Left eye view red
GLState::push().setColorMask(gfx::WriteRed | gfx::WriteAlpha); // Left eye view red
drawContent();
// Right eye view
vrCfg.setCurrentEye(VRConfig::RightEye);
GLState::current().setColorMask(gl::WriteGreen | gl::WriteBlue | gl::WriteAlpha); // Right eye view cyan
GLState::current().setColorMask(gfx::WriteGreen | gfx::WriteBlue | gfx::WriteAlpha); // Right eye view cyan
drawContent();
GLState::pop();
break;
Expand All @@ -284,12 +284,12 @@ DE_PIMPL(VRWindowTransform)
// Left eye view
vrCfg.setCurrentEye(VRConfig::LeftEye);
drawContent();
//canvas().framebuffer().swapBuffers(canvas(), gl::SwapStereoLeftBuffer);
//canvas().framebuffer().swapBuffers(canvas(), gfx::SwapStereoLeftBuffer);

// Right eye view
vrCfg.setCurrentEye(VRConfig::RightEye);
drawContent();
//canvas().framebuffer().swapBuffers(canvas(), gl::SwapStereoRightBuffer);
//canvas().framebuffer().swapBuffers(canvas(), gfx::SwapStereoRightBuffer);
}
else
#endif
Expand Down Expand Up @@ -324,7 +324,7 @@ DE_PIMPL(VRWindowTransform)
// Draw right the eye view.
rowInterRightFB.glInit();
rowInterRightFB.resize(GLFramebuffer::Size(width(), height()));
rowInterRightFB.colorTexture().setFilter(gl::Linear, gl::Linear, gl::MipNone);
rowInterRightFB.colorTexture().setFilter(gfx::Linear, gfx::Linear, gfx::MipNone);
rowInterRightFB.colorTexture().glApplyParameters();
GLState::push()
.setTarget(rowInterRightFB)
Expand Down
6 changes: 3 additions & 3 deletions doomsday/libs/appfw/src/widgets/compositorwidget.cpp
Expand Up @@ -82,12 +82,12 @@ DE_GUI_PIMPL(CompositorWidget)
void glInit()
{
DefaultVertexBuf *buf = new DefaultVertexBuf;
buf->setVertices(gl::TriangleStrip,
buf->setVertices(gfx::TriangleStrip,
DefaultVertexBuf::Builder()
.makeQuad(Rectanglef(0, 0, 1, 1),
Vec4f (1, 1, 1, 1),
Rectanglef(0, 0, 1, -1)),
gl::Static);
gfx::Static);

drawable.addBuffer(buf);
root().shaders().build(drawable.program(), "generic.textured.color") //"debug.textured.alpha"
Expand Down Expand Up @@ -191,7 +191,7 @@ void CompositorWidget::drawComposite()
GLState::push()
.setAlphaTest(false)
.setBlend(true)
.setBlendFunc(gl::One, gl::OneMinusSrcAlpha)
.setBlendFunc(gfx::One, gfx::OneMinusSrcAlpha)
.setDepthTest(false);

d->uTex = buf->texture;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/appfw/src/widgets/lineeditwidget.cpp
Expand Up @@ -198,7 +198,7 @@ DE_GUI_PIMPL(LineEditWidget)
VertexBuf::Builder verts;
self().glMakeGeometry(verts);
drawable.buffer<VertexBuf>(ID_BUF_TEXT)
.setVertices(gl::TriangleStrip, verts, gl::Static);
.setVertices(gfx::TriangleStrip, verts, gfx::Static);

// Cursor.
Rectanglei const caret = self().cursorRect();
Expand All @@ -208,7 +208,7 @@ DE_GUI_PIMPL(LineEditWidget)
atlas().imageRectf(self().root().solidWhitePixel()).middle());

drawable.buffer<VertexBuf>(ID_BUF_CURSOR)
.setVertices(gl::TriangleStrip, verts, gl::Static);
.setVertices(gfx::TriangleStrip, verts, gfx::Static);
}

void updateHover(Vec2i const &pos)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/appfw/src/widgets/logwidget.cpp
Expand Up @@ -732,7 +732,7 @@ DE_GUI_PIMPL(LogWidget)
// Draw the scroll indicator, too.
//self().glMakeScrollIndicatorGeometry(verts);

buf->setVertices(gl::TriangleStrip, verts, gl::Dynamic);
buf->setVertices(gfx::TriangleStrip, verts, gfx::Dynamic);

// Apply changes to content height that may have occurred as text becomes
// available for drawing.
Expand Down Expand Up @@ -766,7 +766,7 @@ DE_GUI_PIMPL(LogWidget)
// Update the background quad.
VertexBuf::Builder bgVerts;
self().glMakeGeometry(bgVerts);
bgBuf->setVertices(gl::TriangleStrip, bgVerts, gl::Static);
bgBuf->setVertices(gfx::TriangleStrip, bgVerts, gfx::Static);
}

background.draw();
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/widgets/scrollareawidget.cpp
Expand Up @@ -703,7 +703,7 @@ void ScrollAreaWidget::drawContent()

d->verts.clear(); //DefaultVertexBuf::Builder verts;
glMakeScrollIndicatorGeometry(d->verts, rule().recti().topLeft + margins().toVector().xy());
//d->drawable.buffer<DefaultVertexBuf>().setVertices(gl::TriangleStrip, verts, gl::Dynamic);
//d->drawable.buffer<DefaultVertexBuf>().setVertices(gfx::TriangleStrip, verts, gfx::Dynamic);

if (d->verts)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/widgets/sliderwidget.cpp
Expand Up @@ -292,7 +292,7 @@ DE_GUI_PIMPL(SliderWidget)
}

/*drawable.buffer<DefaultVertexBuf>()
.setVertices(gl::TriangleStrip, verts, animating? gl::Dynamic : gl::Static);*/
.setVertices(gfx::TriangleStrip, verts, animating? gfx::Dynamic : gfx::Static);*/

self().requestGeometry(false);
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/gui/include/de/graphics/glatlasbuffer.h
Expand Up @@ -34,7 +34,7 @@ class LIBGUI_PUBLIC GLAtlasBuffer
GLAtlasBuffer(internal::AttribSpecs const &vertexFormat);

void setMaxElementCount(dsize maxElementCount);
void setUsage(gl::Usage usage);
void setUsage(gfx::Usage usage);

//void initialize();
//void deinitialize();
Expand Down
26 changes: 13 additions & 13 deletions doomsday/libs/gui/include/de/graphics/glbuffer.h
Expand Up @@ -293,7 +293,7 @@ struct LIBGUI_PUBLIC Vertex3NormalTangentTex
LIBGUI_DECLARE_VERTEX_FORMAT(5)
};

namespace gl {
namespace gfx {

enum Usage {
Static, ///< modified once and used many times
Expand All @@ -309,7 +309,7 @@ enum Usage {

enum Primitive { Points, LineStrip, LineLoop, Lines, TriangleStrip, TriangleFan, Triangles };

} // namespace gl
} // namespace gfx

/**
* GL vertex buffer.
Expand Down Expand Up @@ -366,19 +366,19 @@ class LIBGUI_PUBLIC GLBuffer : public Asset

void clear();

void setVertices(dsize count, void const *data, dsize dataSize, gl::Usage usage);
void setVertices(dsize count, void const *data, dsize dataSize, gfx::Usage usage);

void setVertices(gl::Primitive primitive, dsize count, void const *data, dsize dataSize, gl::Usage usage);
void setVertices(gfx::Primitive primitive, dsize count, void const *data, dsize dataSize, gfx::Usage usage);

void setIndices(gl::Primitive primitive, dsize count, Index const *indices, gl::Usage usage);
void setIndices(gfx::Primitive primitive, dsize count, Index const *indices, gfx::Usage usage);

void setIndices(gl::Primitive primitive, Indices const &indices, gl::Usage usage);
void setIndices(gfx::Primitive primitive, Indices const &indices, gfx::Usage usage);

void setData(void const *data, dsize dataSize, gl::Usage usage);
void setData(void const *data, dsize dataSize, gfx::Usage usage);

void setData(dsize startOffset, void const *data, dsize dataSize);

void setUninitializedData(dsize dataSize, gl::Usage usage);
void setUninitializedData(dsize dataSize, gfx::Usage usage);

/**
* Draws the buffer.
Expand All @@ -391,7 +391,7 @@ class LIBGUI_PUBLIC GLBuffer : public Asset

void drawWithIndices(GLBuffer const &indexBuffer) const;

void drawWithIndices(gl::Primitive primitive, Index const *indices, dsize count) const;
void drawWithIndices(gfx::Primitive primitive, Index const *indices, dsize count) const;

/**
* Draws the buffer with instancing. One instance of the buffer is drawn per
Expand Down Expand Up @@ -438,19 +438,19 @@ class GLBufferT : public GLBuffer
setFormat(VertexType::formatSpec());
}

void setVertices(VertexType const *vertices, dsize count, gl::Usage usage) {
void setVertices(VertexType const *vertices, dsize count, gfx::Usage usage) {
GLBuffer::setVertices(count, vertices, sizeof(VertexType) * count, usage);
}

void setVertices(Vertices const &vertices, gl::Usage usage) {
void setVertices(Vertices const &vertices, gfx::Usage usage) {
GLBuffer::setVertices(vertices.size(), vertices.data(), sizeof(VertexType) * vertices.size(), usage);
}

void setVertices(gl::Primitive primitive, VertexType const *vertices, dsize count, gl::Usage usage) {
void setVertices(gfx::Primitive primitive, VertexType const *vertices, dsize count, gfx::Usage usage) {
GLBuffer::setVertices(primitive, count, vertices, sizeof(VertexType) * count, usage);
}

void setVertices(gl::Primitive primitive, Vertices const &vertices, gl::Usage usage) {
void setVertices(gfx::Primitive primitive, Vertices const &vertices, gfx::Usage usage) {
GLBuffer::setVertices(primitive, vertices.size(), vertices.data(), sizeof(VertexType) * vertices.size(), usage);
}
};
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/gui/include/de/graphics/glframebuffer.h
Expand Up @@ -276,13 +276,13 @@ class LIBGUI_PUBLIC GLFramebuffer : public Asset
*/
void blit(GLFramebuffer &dest,
Flags attachments = Color0,
gl::Filter filtering = gl::Nearest) const;
gfx::Filter filtering = gfx::Nearest) const;

/**
* Blits this target's contents to the default framebuffer.
* @param filtering Blit filtering.
*/
void blit(gl::Filter filtering = gl::Nearest) const;
void blit(gfx::Filter filtering = gfx::Nearest) const;

/**
* Sets the subregion inside the render target where scissor and viewport
Expand Down

0 comments on commit b43d610

Please sign in to comment.