Remove renderGLGeometry from kwinglutils.
Not used anymore - completely replaced by VBO.
This commit is contained in:
parent
5cbd1d458b
commit
9814a8e81b
2 changed files with 0 additions and 157 deletions
|
@ -170,125 +170,6 @@ int nearestPowerOfTwo(int x)
|
||||||
return 1 << last;
|
return 1 << last;
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderGLGeometry(int count, const float* vertices, const float* texture, const float* color,
|
|
||||||
int dim, int stride)
|
|
||||||
{
|
|
||||||
return renderGLGeometry(infiniteRegion(), count, vertices, texture, color, dim, stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderGLGeometry(const QRegion& region, int count,
|
|
||||||
const float* vertices, const float* texture, const float* color,
|
|
||||||
int dim, int stride)
|
|
||||||
{
|
|
||||||
#ifdef KWIN_HAVE_OPENGLES
|
|
||||||
Q_UNUSED(region)
|
|
||||||
Q_UNUSED(count)
|
|
||||||
Q_UNUSED(vertices)
|
|
||||||
Q_UNUSED(texture)
|
|
||||||
Q_UNUSED(color)
|
|
||||||
Q_UNUSED(dim)
|
|
||||||
Q_UNUSED(stride)
|
|
||||||
#else
|
|
||||||
// Using arrays only makes sense if we have larger number of vertices.
|
|
||||||
// Otherwise overhead of enabling/disabling them is too big.
|
|
||||||
bool use_arrays = (count > 5);
|
|
||||||
|
|
||||||
if (use_arrays) {
|
|
||||||
glPushAttrib(GL_ENABLE_BIT);
|
|
||||||
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
|
||||||
// Enable arrays
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
glVertexPointer(dim, GL_FLOAT, stride, vertices);
|
|
||||||
if (texture != NULL) {
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, stride, texture);
|
|
||||||
}
|
|
||||||
if (color != NULL) {
|
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
|
||||||
glColorPointer(4, GL_FLOAT, stride, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clip using scissoring
|
|
||||||
if (!effects->isRenderTargetBound()) {
|
|
||||||
PaintClipper pc(region);
|
|
||||||
for (PaintClipper::Iterator iterator;
|
|
||||||
!iterator.isDone();
|
|
||||||
iterator.next()) {
|
|
||||||
if (use_arrays)
|
|
||||||
glDrawArrays(GL_QUADS, 0, count);
|
|
||||||
else
|
|
||||||
renderGLGeometryImmediate(count, vertices, texture, color, dim, stride);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (use_arrays)
|
|
||||||
glDrawArrays(GL_QUADS, 0, count);
|
|
||||||
else
|
|
||||||
renderGLGeometryImmediate(count, vertices, texture, color, dim, stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (use_arrays) {
|
|
||||||
glPopClientAttrib();
|
|
||||||
glPopAttrib();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderGLGeometryImmediate(int count, const float* vertices, const float* texture, const float* color,
|
|
||||||
int dim, int stride)
|
|
||||||
{
|
|
||||||
#ifdef KWIN_HAVE_OPENGLES
|
|
||||||
Q_UNUSED(count)
|
|
||||||
Q_UNUSED(vertices)
|
|
||||||
Q_UNUSED(texture)
|
|
||||||
Q_UNUSED(color)
|
|
||||||
Q_UNUSED(dim)
|
|
||||||
Q_UNUSED(stride)
|
|
||||||
#else
|
|
||||||
// Find out correct glVertex*fv function according to dim parameter.
|
|
||||||
void (*glVertexFunc)(const float*) = glVertex2fv;
|
|
||||||
if (dim == 3)
|
|
||||||
glVertexFunc = glVertex3fv;
|
|
||||||
else if (dim == 4)
|
|
||||||
glVertexFunc = glVertex4fv;
|
|
||||||
|
|
||||||
// These are number of _floats_ per item, not _bytes_ per item as opengl uses.
|
|
||||||
int vsize, tsize, csize;
|
|
||||||
vsize = tsize = csize = stride / sizeof(float);
|
|
||||||
if (!stride) {
|
|
||||||
// 0 means that arrays are tightly packed. This gives us different
|
|
||||||
// strides for different arrays
|
|
||||||
vsize = dim;
|
|
||||||
tsize = 2;
|
|
||||||
csize = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
// This sucks. But makes it faster.
|
|
||||||
if (texture && color) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
glTexCoord2fv(texture + i * tsize);
|
|
||||||
glColor4fv(color + i * csize);
|
|
||||||
glVertexFunc(vertices + i * vsize);
|
|
||||||
}
|
|
||||||
} else if (texture) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
glTexCoord2fv(texture + i * tsize);
|
|
||||||
glVertexFunc(vertices + i * vsize);
|
|
||||||
}
|
|
||||||
} else if (color) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
glColor4fv(color + i * csize);
|
|
||||||
glVertexFunc(vertices + i * vsize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
glVertexFunc(vertices + i * vsize);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, float y2)
|
void addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, float y2)
|
||||||
{
|
{
|
||||||
verts << x1 << y1;
|
verts << x1 << y1;
|
||||||
|
|
|
@ -85,44 +85,6 @@ inline bool KWIN_EXPORT isPowerOfTwo(int x)
|
||||||
**/
|
**/
|
||||||
int KWIN_EXPORT nearestPowerOfTwo(int x);
|
int KWIN_EXPORT nearestPowerOfTwo(int x);
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders quads using given vertices.
|
|
||||||
* If texture is not 0, each texture coordinate much have two components (st).
|
|
||||||
* If color is not 0, each color much have four components (rgba).
|
|
||||||
* Note that texture coordinates must match texture type (normalized/unnormalized
|
|
||||||
* for GL_TEXTURE_2D/GL_TEXTURE_ARB).
|
|
||||||
*
|
|
||||||
* In OpenGL ES this method is a no-op.
|
|
||||||
*
|
|
||||||
* @param count number of vertices to use.
|
|
||||||
* @param dim number of components per vertex coordinate in vertices array.
|
|
||||||
* @param stride byte offset of consecutive elements in arrays. If 0, then
|
|
||||||
* arrays must be tighly packed. Stride must be a multiple of sizeof(float)!
|
|
||||||
* @deprecated Use GLVertexBuffer
|
|
||||||
* @see GLVertexBuffer
|
|
||||||
**/
|
|
||||||
KWIN_EXPORT void renderGLGeometry(const QRegion& region, int count,
|
|
||||||
const float* vertices, const float* texture = 0, const float* color = 0,
|
|
||||||
int dim = 2, int stride = 0);
|
|
||||||
/**
|
|
||||||
* Same as above, renders without specified region
|
|
||||||
* @deprecated Use GLVertexBuffer
|
|
||||||
* @see GLVertexBuffer
|
|
||||||
**/
|
|
||||||
KWIN_EXPORT void renderGLGeometry(int count,
|
|
||||||
const float* vertices, const float* texture = 0, const float* color = 0,
|
|
||||||
int dim = 2, int stride = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In OpenGL ES this method is a no-op.
|
|
||||||
*
|
|
||||||
* @deprecated Use GLVertexBuffer
|
|
||||||
* @see GLVertexBuffer
|
|
||||||
**/
|
|
||||||
KWIN_EXPORT void renderGLGeometryImmediate(int count,
|
|
||||||
const float* vertices, const float* texture = 0, const float* color = 0,
|
|
||||||
int dim = 2, int stride = 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Quads are not available in OpenGL ES
|
* @deprecated Quads are not available in OpenGL ES
|
||||||
**/
|
**/
|
||||||
|
|
Loading…
Reference in a new issue