- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个三角测量应用程序,我可以在窗口中的框架三角形内单击以将其 segmentation 为 3 个三角形,依此类推。因此,每次我添加一个点时,我都会将两个三角形添加到定义为类 Triangle 的结构中(请参阅 Triangle.h 和 .cpp)。对于每个对象三角形,我跟踪它的 ID、它的 3 个顶点的索引和它的 3 个相邻三角形的索引,其中第一个顶点和第一个相邻三角形是相反的。
然后我用 GL_POINTS
和 GL_LINE_LOOP
绘制每个点和每个三角形。
如果我使用 glClear(GL_COLOR_BUFFER_BIT)
,线条会闪烁。如果我不使用它,则不会发生闪烁。
我的主要问题是三角形绘制不一致。当我单击三角形内的一个新点时,应在该点和构成包含该点的三角形的 3 个点之间画线。有时它应该发生,有时会出现额外的行。我检查了我的结构,我的类 Triangle 没有错误。我针对添加的每个点和三角剖分的每次更新分别验证了每个属性。
当我使用 drawTriangle 函数时,我调用了 3 次 glVertex2i(x1, y1)
以正确绘制三角形。不明白为什么可以同时画4-5条线。它也不明白为什么有时会发生有时不会。
我认为我对 openGL 的使用存在冲突...就像我进行计算和更新我的三角剖分结构而 openGL 会绘制部分结果...我似乎无法完美控制重新显示使用 glutPostRedisplay
绘制...
双缓冲能解决我的问题吗?有没有一种方法可以让我自己调用自己来更新绘图,而不是依赖 glutPostRedisplay
和 glutMainLoop
以及诸如此类的事情。
/*-----------------------------------------
Name: main
Author: Michael Landry
Description: main program
Date: 2018-02-22
Version: 1.00
-------------------------------------------*/
#include <GL/glut.h>
#include <iostream>
#include <vector>
#include "functions.h"
#include "Point.h"
#include "Triangle.h"
GLfloat BLUE[3] = { 0,0,1 };
std::vector <Point> pointList;
std::vector <Triangle> triangleList;
int main(int argc, char **argv)
{
// Give directions to user
std::cout << "*** Welcome to the Delaunay Triangulation tool ***" << std::endl << std::endl;
std::cout << "Left click to insert a point to the triangulation or right click to exit." << std::endl << std::endl;
// Create the boundary triangle
Frame();
// Initialize GLUT display window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT);
glutInitWindowPosition(0, 0);
glutCreateWindow("Delaunay Triangulation");
// Call the display function for drawing
glutDisplayFunc(display);
glutReshapeFunc(reshape);
// Call the mouse callback function
glutMouseFunc(mouse);
glutIdleFunc(spindisplay);
glutMainLoop();
return 0;
}
/*-----------------------------------------
Name: functions
Author: Michael Landry
Description: functions for second lab
Date: 2018-02-22
Version: 1.00
-------------------------------------------*/
#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
#include "Point.h"
#include "Triangle.h"
const int SCREEN_WIDTH = 1366;
const int SCREEN_HEIGHT = 768;
void drawPoint(void);
void drawTriangle(void);
void display(void);
void reshape(int w, int h);
void spindisplay(void);
void mouse(int btn, int state, int x, int y);
void Frame(void);
bool inTriangle(const Point&);
void insert(const int);
int walk(const Point&);
#endif
/*-----------------------------------------
Name: functions
Author: Michael Landry
Description: functions for second lab
Date: 2018-02-22
Version: 1.00
-------------------------------------------*/
#include <GL/glut.h>
#include "Point.h"
#include "Triangle.h"
#include "functions.h"
#include <iostream>
#include <vector>
extern GLfloat BLUE[3];
extern std::vector <Point> pointList;
extern std::vector <Triangle> triangleList;
/*
Name: drawTriangle
Description: draw the triangulation
*/
void drawTriangle(void)
{
glColor3fv(BLUE);
glBegin(GL_LINE_LOOP);
for (size_t i = 0; i < triangleList.size(); i++)
{
// Extract the coordinates of the first point of the triangle
int x1 = pointList[triangleList[i].getS1() - 1].getX(); // -1 because the vector starts at 0
int y1 = pointList[triangleList[i].getS1() - 1].getY();
// Extract the coordinates of the second point of the triangle
int x2 = pointList[triangleList[i].getS2() - 1].getX();
int y2 = pointList[triangleList[i].getS2() - 1].getY();
// Extract the coordinates of the third point of the triangle
int x3 = pointList[triangleList[i].getS3() - 1].getX();
int y3 = pointList[triangleList[i].getS3() - 1].getY();
// Draw the triangle formed by the 3 points
glVertex2i(x1, y1);
glVertex2i(x2, y2);
glVertex2i(x3, y3);
}
glEnd();
glFlush();
}
/*
Name: drawPoint
Description: draw points in the window
*/
void drawPoint(void)
{
glColor3fv(BLUE);
glBegin(GL_POINTS);
for (size_t i = 0; i < pointList.size(); i++)
{
// Extract the coordinates of the point
int x = pointList[i].getX();
int y = pointList[i].getY();
// Draw the point
glVertex2i(x, y);
}
glEnd();
glFlush();
}
/*
Name: display
Description: prepare the window for display
*/
void display(void)
{
glClearColor(0.0, 0.0, 0.0, 1.0);
// glClear(GL_COLOR_BUFFER_BIT); // command is disabled to stop flickering
glLoadIdentity();
glPointSize(5);
drawPoint();
drawTriangle();
glFlush();
}
/*
Name: reshape
Description: reshape the window
*/
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/*
Name: spindisplay
Description: prepare for a redisplay
*/
void spindisplay(void)
{
glutPostRedisplay();
}
/*
Name: mouse
Description: detect left button click on mouse
*/
void mouse(int btn, int state, int x, int y)
{
if (btn == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
{
// Generate a new object point with the cursor coordinates on click event
Point newPoint(x, y, 1);
// Verify if the point is inside the boundary triangle and if it does not already exists in the list
if ((inTriangle(newPoint) == 1) && ((newPoint == pointList) == 0))
{
// Only add the point to the list if it is inside the boundary triangle
pointList.push_back(newPoint);
std::cout << "New point added" << std::endl;
std::cout << "x : " << x << " " << "y : " << y << std::endl;
std::cout << "Total number of points : " << pointList.size() << std::endl << std::endl;
// Find the triangle containing the new point
int triangleIndex = walk(newPoint);
std::cout << "Divide triangle number " << triangleIndex + 1 << std::endl << std::endl;
// Insert the new point in the triangulation
insert(triangleIndex);
std::cout << "ID S1 S2 S3 T1 T2 T3" << std::endl;
for (size_t i = 0; i < triangleList.size(); i++)
{
std::cout << triangleList[i].getID() << " " << triangleList[i].getS1() << " " << triangleList[i].getS2() << " " << triangleList[i].getS3() << " " << triangleList[i].getT1() << " " << triangleList[i].getT2() << " " << triangleList[i].getT3() << " " << std::endl;
}
std::cout << std::endl;
}
glutPostRedisplay();
}
if (btn == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
{
exit(1); // Exit the program
}
}
/*
Name: Frame
Description: create the initial boundary triangle
*/
void Frame(void)
{
// First point
Point myPoint1(SCREEN_WIDTH / 2, 100, 1);
pointList.push_back(myPoint1);
// Second point
Point myPoint2(100, SCREEN_HEIGHT - 100, 1);
pointList.push_back(myPoint2);
// Third point
Point myPoint3(SCREEN_WIDTH - 100, SCREEN_HEIGHT - 100, 1);
pointList.push_back(myPoint3);
// Create the first triangle of the list
Triangle triangleFrame(1, 1, 2, 3, 0, 0, 0);
triangleList.push_back(triangleFrame);
}
/*
Name: getDeterminant
Description: calculate the determinant of a 3 x 3 matrix
*/
int getDeterminant(const Point &point1, const Point &point2, const Point &point3)
{
// Form a 5 x 3 matrix containing the 3 triangle points
std::vector <Point> pointTriangle;
pointTriangle.push_back(point1);
pointTriangle.push_back(point2);
pointTriangle.push_back(point3);
pointTriangle.push_back(point1);
pointTriangle.push_back(point2);
// Calculate the determinant with the shoelace method
int detTriangle = 0;
int detTrianglePart;
for (int j = 0; j < 3; j++)
{
detTrianglePart = ((pointTriangle[j].getX() * pointTriangle[j + 1].getY() * pointTriangle[j + 2].getZ()) - (pointTriangle[j + 2].getX() * pointTriangle[j + 1].getY() * pointTriangle[j].getZ()));
detTriangle = detTriangle + detTrianglePart;
}
return detTriangle;
}
/*
Name: inTriangle
Description: test if a point is inside a triangle
*/
bool inTriangle(const Point& newPoint)
{
// Pre loop conditions
int k = 0; // counter
int detTriangle = -1;
int row = 3; // 3 points
int col = 3; // 3 coordinates
// Loop on all the points if the determinant stays negative
while ((k < row) && (detTriangle < 0))
{
// Initialize an object the 3 points
Point point1;
Point point2;
Point point3;
// Extract 2 points from the list of points
if (k == row - 1)
{
point1 = pointList[k];
point2 = pointList[k - row + 1];
point3 = newPoint;
}
else
{
point1 = pointList[k];
point2 = pointList[k + 1];
point3 = newPoint;
}
// Get the determinant of the triangle
detTriangle = getDeterminant(point1, point2, point3);
// Incrementation of the counter
k++;
}
// Output the position of the point
bool isInside = 0;
(detTriangle < 0) ? (isInside = 1) : (isInside = 0);
return isInside;
}
/*
Name: insert
Description: insert the new point and create 3 new triangles
*/
void insert(const int triangleIndex)
{
// Extract the Index of the new point
int newPointIndex = pointList.size();
// Create the line of the second new triangle
Triangle triangle2(triangleList.size() + 1, newPointIndex, triangleList[triangleIndex].getS3(), triangleList[triangleIndex].getS1(), triangleList[triangleIndex].getT2(), triangleList.size() + 2, triangleIndex + 1);
// Create the line of the third new triangle
Triangle triangle3(triangleList.size() + 2, newPointIndex, triangleList[triangleIndex].getS1(), triangleList[triangleIndex].getS2(), triangleList[triangleIndex].getT3(), triangleIndex + 1, triangleList.size() + 1);
// Get the adjacent triangles of the base triangle
int T1 = triangleList[triangleIndex].getT1();
int T2 = triangleList[triangleIndex].getT2();
int T3 = triangleList[triangleIndex].getT3();
// Update the line of first new triangle
triangleList[triangleIndex].setS1(newPointIndex);
triangleList[triangleIndex].setT2(triangleList.size() + 1);
triangleList[triangleIndex].setT3(triangleList.size() + 2);
// Update the adjacent triangles
if (T2 != 0 && T3 != 0)
{
triangleList[T2 - 1].setT3(triangleList.size() + 1); // T-1 because vector starts at 0
triangleList[T3 - 1].setT2(triangleList.size() + 2);
}
// Insert the new triangles in the triangulation
triangleList.push_back(triangle2);
triangleList.push_back(triangle3);
}
/*
Name: inCircle
Description: determine if a point is inside a circle
*/
bool inCircle(const Point& newPoint, const int triangleIndex)
{
// Get the coordinates of the new point
int x = newPoint.getX();
int y = newPoint.getY();
int z = newPoint.getZ();
// Get the coordinates of the first point
int x1 = pointList[triangleList[triangleIndex].getS1()].getX();
int y1 = pointList[triangleList[triangleIndex].getS1()].getY();
int z1 = pointList[triangleList[triangleIndex].getS1()].getZ();
// Get the coordinates of the second point
int x2 = pointList[triangleList[triangleIndex].getS2()].getX();
int y2 = pointList[triangleList[triangleIndex].getS2()].getY();
int z2 = pointList[triangleList[triangleIndex].getS2()].getZ();
// Get the coordinates of the third point
int x3 = pointList[triangleList[triangleIndex].getS3()].getX();
int y3 = pointList[triangleList[triangleIndex].getS3()].getY();
int z3 = pointList[triangleList[triangleIndex].getS3()].getZ();
// Create the 4 x 4 matrix
int pointArray[4][4] = { { x,y,z,1 }, {x1,y1,z1,1}, {x2,y2,z2,1}, {x3,y3,z3,1} };
// Create the 3 points of the first block A
Point pointA1(pointArray[1][1], pointArray[1][2], pointArray[1][3]);
Point pointA2(pointArray[2][1], pointArray[2][2], pointArray[2][3]);
Point pointA3(pointArray[3][1], pointArray[3][2], pointArray[3][3]);
// Create the 3 points of the second block B
Point pointB1(pointArray[1][0], pointArray[1][2], pointArray[1][3]);
Point pointB2(pointArray[2][0], pointArray[2][2], pointArray[2][3]);
Point pointB3(pointArray[3][0], pointArray[3][2], pointArray[3][3]);
// Create the 3 points of the third block C
Point pointC1(pointArray[1][0], pointArray[3][1], pointArray[1][3]);
Point pointC2(pointArray[2][0], pointArray[2][1], pointArray[2][3]);
Point pointC3(pointArray[3][0], pointArray[1][1], pointArray[3][3]);
// Create the 3 points of the fourth block D
Point pointD1(pointArray[1][0], pointArray[3][1], pointArray[1][2]);
Point pointD2(pointArray[2][0], pointArray[2][1], pointArray[2][2]);
Point pointD3(pointArray[3][0], pointArray[1][1], pointArray[3][2]);
// Find the determinant
int determinant = pointArray[0][0] * getDeterminant(pointA1, pointA2, pointA3) - pointArray[0][1] * getDeterminant(pointB1, pointB2, pointB3) + pointArray[0][2] * getDeterminant(pointC1, pointC2, pointC3) - pointArray[0][3] * getDeterminant(pointD1, pointD2, pointD3);
// Return the test value (1 if the point is inside the circle, 0 if not)
bool isInside;
(determinant < 0) ? (isInside = 1) : (isInside = 0);
return isInside;
}
/*
Name: walk
Description: find the triangle containing the new point
*/
int walk(const Point& newPoint)
{
// First triangle to test by default
int triangleToTest = 0;
int triangleIndex = -1;
do
{
// Define the points forming the first line to test
Point point1 = pointList[triangleList[triangleToTest].getS1() - 1];
Point point2 = pointList[triangleList[triangleToTest].getS2() - 1];
// Get the determinant
int determinant = getDeterminant(point1, point2, newPoint);
// Test if the point is on the left side of the line
if (determinant < 0)
{
// Define the points forming the second line to test
point1 = pointList[triangleList[triangleToTest].getS2() - 1];
point2 = pointList[triangleList[triangleToTest].getS3() - 1];
determinant = getDeterminant(point1, point2, newPoint);
// Test if the point is on the left side of the line
if (determinant < 0)
{
// Define the points forming the third line to test
point1 = pointList[triangleList[triangleToTest].getS3() - 1];
point2 = pointList[triangleList[triangleToTest].getS1() - 1];
determinant = getDeterminant(point1, point2, newPoint);
// Test if the point is on the left side of the line
if (determinant < 0)
{
triangleIndex = triangleToTest;
}
else
{
triangleToTest = triangleList[triangleToTest].getT2() - 1;
}
}
else
{
triangleToTest = triangleList[triangleToTest].getT1() - 1;
}
}
else
{
triangleToTest = triangleList[triangleToTest].getT3() - 1;
}
} while (triangleIndex == -1);
return triangleIndex;
}
/*-----------------------------------------
Name: Point
Author: Michael Landry
Description: Declaration of class Point
Date: 2018-02-15
Version: 1.00
-------------------------------------------*/
#ifndef POINT_H_
#define POINT_H_
#include <iostream>
#include <vector>
class Point
{
public:
// Default constructor
Point();
// Constructor with parameters
Point(int, int, int);
// Setters
void setPoint(int p_X, int p_Y, int p_Z);
void setX(int p_X);
void setY(int p_Y);
void setZ(int p_Z);
// Getters
int getX() const;
int getY() const;
int getZ() const;
// Overloaded operator
bool Point::operator==(const std::vector <Point> & p_pointList) const;
private:
// 3D coordinates as attributes
int m_X;
int m_Y;
int m_Z;
};
#endif /* POINT_H_ */
/*-----------------------------------------
Name: Point
Author: Michael Landry
Description: Implementation of class Point
Date: 2018-02-15
Version: 1.00
-------------------------------------------*/
#include "Point.h"
#include <iostream>
#include <vector>
// Default constructor initialises (0,0,0) as coordinates
Point::Point() : m_X(0), m_Y(0), m_Z(0)
{
}
// Constructor with parameters
Point::Point(int p_X, int p_Y, int p_Z) : m_X(p_X), m_Y(p_Y), m_Z(p_Z)
{
}
// Setter for the 3 coordinates
void Point::setPoint(int p_X, int p_Y, int p_Z)
{
m_X = p_X;
m_Y = p_Y;
m_Z = p_Z;
}
// Setter for each coordinate
void Point::setX(int p_X)
{
m_X = p_X;
}
void Point::setY(int p_Y)
{
m_Y = p_Y;
}
void Point::setZ(int p_Z)
{
m_Y = p_Z;
}
// Getter for each coordinate
int Point::getX() const
{
return m_X;
}
int Point::getY() const
{
return m_Y;
}
int Point::getZ() const
{
return m_Z;
}
// Overloaded operator
bool Point::operator==(const std::vector <Point> & p_pointList) const
{
// Initialize a counter
size_t i = 0;
bool isEqual = true;
do
{
isEqual = (m_X == p_pointList[i].getX()) && (m_Y == p_pointList[i].getY()) && (m_Z == p_pointList[i].getZ());
i++;
} while ((i < p_pointList.size()) && (isEqual == false));
return isEqual;
}
/*-----------------------------------------
Name: Triangle
Author: Michael Landry
Description: Declaration of class Triangle
Date: 2018-02-23
Version: 1.00
-------------------------------------------*/
#ifndef TRIANGLE_H_
#define TRIANGLE_H_
class Triangle
{
public:
// Constructor with no parameter
Triangle::Triangle();
// Constructor with parameters
Triangle::Triangle(int, int, int, int, int, int, int);
// Setters
void Triangle::setTriangle(int p_ID, int p_S1, int p_S2, int p_S3, int p_T1, int p_T2, int p_T3);
void Triangle::setID(int p_ID);
void Triangle::setS1(int p_S1);
void Triangle::setS2(int p_S2);
void Triangle::setS3(int p_S3);
void Triangle::setT1(int p_T1);
void Triangle::setT2(int p_T1);
void Triangle::setT3(int p_T1);
// Getters
int Triangle::getID() const;
int Triangle::getS1() const;
int Triangle::getS2() const;
int Triangle::getS3() const;
int Triangle::getT1() const;
int Triangle::getT2() const;
int Triangle::getT3() const;
private:
// The ID of the triangle
int m_ID;
// The 3 vertices forming the triangle
int m_S1;
int m_S2;
int m_S3;
// The 3 adjacent triangles
int m_T1;
int m_T2;
int m_T3;
};
#endif /* TRIANGLE_H_ */
/*-----------------------------------------
Name: Triangle
Author: Michael Landry
Description: Implementation of class Triangle
Date: 2018-02-23
Version: 1.00
-------------------------------------------*/
#include "Triangle.h"
// Constructor with no parameter
Triangle::Triangle() : m_ID(0), m_S1(0), m_S2(0), m_S3(0), m_T1(0), m_T2(0), m_T3(0)
{
}
// Constructor with parameters
Triangle::Triangle(int p_ID, int p_S1, int p_S2, int p_S3, int p_T1, int p_T2, int p_T3) : m_ID(p_ID), m_S1(p_S1), m_S2(p_S2), m_S3(p_S3), m_T1(p_T1), m_T2(p_T2), m_T3(p_T3)
{
}
// Global setter
void Triangle::setTriangle(int p_ID, int p_S1, int p_S2, int p_S3, int p_T1, int p_T2, int p_T3)
{
m_ID = p_ID;
m_S1 = p_S1;
m_S2 = p_S2;
m_S3 = p_S3;
m_T1 = p_T1;
m_T2 = p_T2;
m_T3 = p_T3;
}
// Setter for each individual parameter
void Triangle::setID(int p_ID)
{
m_ID = p_ID;
}
void Triangle::setS1(int p_S1)
{
m_S1 = p_S1;
}
void Triangle::setS2(int p_S2)
{
m_S2 = p_S2;
}
void Triangle::setS3(int p_S3)
{
m_S3 = p_S3;
}
void Triangle::setT1(int p_T1)
{
m_T1 = p_T1;
}
void Triangle::setT2(int p_T2)
{
m_T2 = p_T2;
}
void Triangle::setT3(int p_T3)
{
m_T3 = p_T3;
}
// Getter for each individual parameter
int Triangle::getID() const
{
return m_ID;
}
int Triangle::getS1() const
{
return m_S1;
}
int Triangle::getS2() const
{
return m_S2;
}
int Triangle::getS3() const
{
return m_S3;
}
int Triangle::getT1() const
{
return m_T1;
}
int Triangle::getT2() const
{
return m_T2;
}
int Triangle::getT3() const
{
return m_T3;
}
最佳答案
我建议从所有代码中删除所有 glFlush
和 glutPostRedisplay
调用。
但是,在空闲函数 spindisplay
中保留 glutPostRedisplay
调用:
void spindisplay(void)
{
glutPostRedisplay();
}
使用双缓冲:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
并在主循环函数 display
的末尾放置一个 glutSwapBuffers
调用:
void display(void)
{
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glPointSize(5);
drawPoint();
drawTriangle();
glutSwapBuffers();
}
如果你想保留单个缓冲区,
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
然后你必须在 display
函数的末尾执行一个 glFinish
调用:
void display(void)
{
.....
glFinish();
}
关于c++ - OpenGL 闪烁并绘制了比 C++ 应有的更多的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48981153/
我是 Jetpack Compose 的新手。我目前正在开发一个聊天应用程序。我要求用户从图库中选择图像或从相机中拍照。然后我将文件 Uri 保存到数据库中,然后收听所有消息的列表。更新此列表时,此图
强制性代码,但 jsFiddle 准确地演示了这个问题。我有一个在 3 秒内扩大和淡出的圆圈。声纳风格是我的意图。问题是动画完成后它会快速“闪烁”然后重新开始。 请在此处查看问题:http://jsf
您好,我有一个多种颜色的 Logo ,我想将其用于随机/不稳定的故意闪烁效果。我只能找到其他关于使用淡入/淡出功能进行闪烁技巧的文章。关于如何用 css3 和/或 jQuery 做这样的技巧有什么想法
我正在使用 Swing 创建组件并使用 GLCanvas (com.jogamp.opengl.awt.GLCanvas) 创建我的窗口。 接下来就是问题了 在初始状态下,一切正常,但是当我拖动窗口调
我将 PhoneGap 2.2.0 与 jQuery Mobile 1.2.0 结合用于我在 Android 平台(版本 2.3.3 及更高版本)上的应用程序。在我使用固定标题的页面上,根本没有转换。
在我们使用 JavaScript 向页面添加图像或文本后,我们的网页在 iPad 上闪烁。我们尝试了 -webkit-backface-visibility:hidden; 的各种组合; -webki
有人能告诉我为什么在这个使用 SwingWorker 的简单演示中,屏幕闪烁,好像按钮不断跳跃一样? (关于改进多线程部分的反馈也值得赞赏)。 import java.awt.EventQueue;
我正在运行时从 CSV 文件向字符串网格添加多行,但是 StringGrid 在更新时似乎会闪烁很多,我认为会有一个 beginupadate/Endupdate 命令来停止此操作。但是我找不到它。有
我的窗口中有一个文本元素,我希望它每隔几秒或几毫秒闪烁一次或出现并消失。 我的代码是: import QtQuick 2.6 import QtQuick.Window 2.2 Window {
我的窗口中有一个文本元素,我希望它每隔几秒或几毫秒闪烁一次或出现并消失。 我的代码是: import QtQuick 2.6 import QtQuick.Window 2.2 Window {
我在UIButtons中有3个UIView,它们具有相同的文本颜色和相同的背景颜色。轻按三个按钮即可触发相应的事件。但是只有其中之一会响应触摸而“闪烁”。其他两个会发生什么?它们有时(但很少)具有“闪
我在 iOS 8 下实现 UIRefreshControl 时遇到了一种闪烁。每次我第一次到达 tableView 的顶部时(即应用程序刚刚启动时),我都会看到下面的 gif 中显示的闪烁。这不会发生
我希望有人能帮助我。我遇到以下问题: http://jsfiddle.net/zhPAF/ 标记: About Us
当鼠标悬停在图像“A”上时,尝试让图像“B”覆盖在图像“A”上。理想情况下,我希望它淡入。 HTML: jQuery:
我有一个 TabControl,我可以在其中添加/删除多个 TabPage。 当我添加足够多的页面以至于必须显示导航按钮时,我遇到了闪烁问题。 当导航按钮(左右导航的 2 个箭头)未显示时,我根本没有
我尝试实现自定义双缓冲,但它会导致闪烁。 这是控件(继承自Control的自定义控件)构造函数中的代码: bufferContext = new BufferedGraphicsContext();
我有以下代码: var footer = $('.footer'), extra = 0; // footer.css({ opacity: '0', display: 'block' });
我遇到了与 JPanel 中闪烁相关的问题。不知道为什么, window 里的球时不时地闪烁。我尝试了几种方法,比如双缓冲、BufferStrategy、Canvas,但都不起作用。主要思想是使用线程
我试图在 OpenGL 中绘制一些文本,而程序绘制立方体或任何 Opengl native ,因此,当我尝试将文本放在屏幕上时,它闪烁得非常快,我不知道为什么,我试图改变 sleep 值什么都没有..
我已经使用 LibGDX UI Setup 启动了一个项目。 我在 implements ApplicationListener 中唯一拥有的是: public void create() {
我是一名优秀的程序员,十分优秀!