Hi Dark Photon,
It will be too much code to put , so i will insert only the main code about OpenGL:
Rendering code:
glDrawElements(GL_TRIANGLES,QtdIndices, GL_UNSIGNED_INT, 0);
Bind buffers code:
glBindBuffer(GL_ARRAY_BUFFER, Id[0]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Id[1]);
quintptr offset = 0;
int vertexLocation = pShader->attributeLocation("a_position");
pShader->enableAttributeArray(vertexLocation);
glVertexAttribPointer(vertexLocation ,
3 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData) ,
(const void *)offset);
offset += sizeof(CIMTVetor);
int texcoordLocation = pShader->attributeLocation("a_texcoord");
pShader->enableAttributeArray(texcoordLocation);
glVertexAttribPointer(texcoordLocation,
2 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData),
(const void *)offset);
offset += sizeof(CIMTVetor2);
int normalcoordLocation = pShader->attributeLocation("a_normal");
pShader->enableAttributeArray(normalcoordLocation);
glVertexAttribPointer(normalcoordLocation,
3 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData) ,
(const void *)offset);
offset += sizeof(CIMTVetor);
int smoothcoordLocation = pShader->attributeLocation("a_smooth");
pShader->enableAttributeArray(smoothcoordLocation);
glVertexAttribPointer(smoothcoordLocation,
3 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData) ,
(const void *)offset);
offset += sizeof(CIMTVetor);
int tancoordLocation = pShader->attributeLocation("a_tangente");
pShader->enableAttributeArray(tancoordLocation);
glVertexAttribPointer(tancoordLocation,
3 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData) ,
(const void *)offset);
offset += sizeof(CIMTVetor);
int bitancoordLocation = pShader->attributeLocation("a_bitangente");
pShader->enableAttributeArray(bitancoordLocation);
glVertexAttribPointer(bitancoordLocation,
3 ,
GL_FLOAT ,
GL_FALSE ,
sizeof(VertexData) ,
(const void *)offset);
Buffers initialization code:
glGenBuffers(3, vboIds);
glGenQueries(1, qryIds);
glBindBuffer(GL_ARRAY_BUFFER, vboIds[0]);
glBufferData(GL_ARRAY_BUFFER,
QtdVertices * sizeof(VertexData),
VertexBuffer,
GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIds[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
QtdIndices * sizeof(GLuint),
VertexIndices,
GL_STATIC_DRAW);
OpenGL states used during rendering:
glClear ( GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
GL_ACCUM_BUFFER_BIT );
glEnable (GL_DEPTH_TEST );
glEnable (GL_CULL_FACE );
glCullFace (GL_BACK);
glPolygonMode(GL_FRONT,GL_FILL);
glEnable (GL_TEXTURE_2D );
I not believe is a problem in the code since this is a multiplatform engine and it works in iOS,Android , Windows, Mac and Linux machines nicelly.
I cannot provide a executable becouse i will need generate a installation package , since i use Qt and a lot of pre-requisites, but it are avaliable in GitHub as Insane Engine 3D and you can request access to it(You will have less work getting the engine from there and run it than the work i will have to generate the package).
The most strange thing about this issue , is becouse only happen on AMD R7 and R9 graphics cards and with updates that come with OpenGL 4.4 and 4.5 on it.
If i install the original driver (with OpenGL 4.3) it works nicelly.
For example i install my R9 280x in my machine last week and the system works nicelly , yesterday a update on the graphic card was made and the system start to show the deph issue…
In the same day i test the same code on my student machines (I am a 3D OpenGL programming professor at University) and in all other machives the code works lovelly(NVIDIA and IBM graphic cards and some machines Mac and Linux S.O´s), so the problem are only heppening in AMD graphic cards with updates(If i use the original driver - that come with the card - the system works too).
This issue are affecting all my main 3D objects where my objects are benig rendered well but without “deph”…(In the Image 2 we se a box being rendered in front of the mountain, but this box are located behind the mountain and cannot be rendered…).
Any help with this will be much appreciated, since i dont want change my graphics card since i like the AMD cards, and i want my system being updated…(Acctually i need black driver updates to avoid this problem).
AMD do not give any feedback about this issue too…
Kind Regards.