MCPcopy Create free account
hub / github.com/OGRECave/ogre / _render

Method _render

RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp:931–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929 }
930
931 void GL3PlusRenderSystem::_render(const RenderOperation& op)
932 {
933 // Call super class.
934 RenderSystem::_render(op);
935
936 if (!mProgramManager->getActiveProgram())
937 {
938 LogManager::getSingleton().logError("Failed to create shader program.");
939 }
940
941 bool hasMeshShader = mCurrentShader[GPT_MESH_PROGRAM] != 0;
942 if(hasMeshShader)
943 {
944 for(auto it : op.vertexData->vertexBufferBinding->getBindings())
945 {
946 auto buf = it.second->_getImpl<GL3PlusHardwareBuffer>();
947 buf->setGLBufferBinding(it.first + 3, GL_SHADER_STORAGE_BUFFER);
948 }
949 }
950
951 GLVertexArrayObject* vao =
952 static_cast<GLVertexArrayObject*>(op.vertexData->vertexDeclaration);
953 // Bind VAO (set of per-vertex attributes: position, normal, etc.).
954 vao->bind(this);
955 bool updateVAO = vao->needsUpdate(op.vertexData->vertexBufferBinding, 0);
956
957 if (updateVAO)
958 vao->bindToGpu(this, op.vertexData->vertexBufferBinding, 0);
959
960 // We treat index buffer binding inside VAO as volatile, always updating and never relying onto it,
961 // as one shared vertex buffer could be rendered with several index buffers, from submeshes and/or LODs
962 if (op.useIndexes)
963 mStateCacheManager->bindGLBuffer(GL_ELEMENT_ARRAY_BUFFER,
964 op.indexData->indexBuffer->_getImpl<GL3PlusHardwareBuffer>()->getGLBufferId());
965
966 auto numberOfInstances = op.numberOfInstances;
967
968 // Determine the correct primitive type to render.
969 GLint primType;
970 switch (op.operationType)
971 {
972 case RenderOperation::OT_POINT_LIST:
973 primType = GL_POINTS;
974 break;
975 case RenderOperation::OT_LINE_LIST:
976 primType = GL_LINES;
977 break;
978 case RenderOperation::OT_LINE_LIST_ADJ:
979 primType = GL_LINES_ADJACENCY;
980 break;
981 case RenderOperation::OT_LINE_STRIP:
982 primType = GL_LINE_STRIP;
983 break;
984 case RenderOperation::OT_LINE_STRIP_ADJ:
985 primType = GL_LINE_STRIP_ADJACENCY;
986 break;
987 default:
988 case RenderOperation::OT_TRIANGLE_LIST:

Callers 1

updateMethod · 0.45

Calls 10

logErrorMethod · 0.80
needsUpdateMethod · 0.80
bindToGpuMethod · 0.80
getActiveProgramMethod · 0.45
setGLBufferBindingMethod · 0.45
bindMethod · 0.45
bindGLBufferMethod · 0.45
getGLBufferIdMethod · 0.45
getTypeMethod · 0.45
getProcAddressMethod · 0.45

Tested by

no test coverage detected