Hi all,
I am new here, and also a newcomer in OpenGL.
I encount a practical problem in OpenGL, will anyone give me suggestions?
In my project, I try to use a huge number of vertices to rendering a image.
I will load about 100 million vertics to rederning image in large or small FOV(Field of view).
Because of too many vertices, my performance is very poor.
And small objects are not visible in the large field of view.
I wondering if there are any settings in OpenGL that can ignore smll objects when rendering image of big FOV.
Because small objects also need when rendering samll FOV, I can’t just remove small objects from those vertices.
Thanks! there is my rendering code.
//
void GLImageGenerator::GLScanImage(double* translate)
{
glm::mat4 trans = GetTrans(translate);
print(trans);
// trans = glm::scale(trans, glm::vec3(250, 250, 250));
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
unsigned int transformLoc = glGetUniformLocation(ourShader.ID, "transform");
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(trans));
unsigned int myOffset = glGetUniformLocation(ourShader.ID, "dieOffset");
glUniform3f(myOffset, (GLfloat) 21.0, (GLfloat) 21.0, 9);
ourShader.use();
glBindVertexArray(m_VAO);
// glMultiDrawArrays(GL_TRIANGLE_FAN, m_fans_starts, m_fans_size, m_boxCount);
// glMultiDrawArrays(GL_LINE_LOOP, m_fans_starts, m_fans_size, m_boxCount);
// glMultiDrawArraysIndirect(GL_LINE_LOOP, m_indirectArray, m_boxCount, 0);
for (int i = 0; i < m_boxCount; ++i)
{
glDrawArraysInstanced(GL_LINE_LOOP, i * 4, 4, 81);
}
GLenum err;
while ((err = glGetError()) != GL_NO_ERROR) {
std::cout << err;
}
}