I'm using LWJGL. I'm trying to create a simple 3D map using GL_TRIANGLE_STRIP and it works fine. But now OpenGL automatically fills up every triangle. I was wondering if it is possible for OpenGL to only draw the outlines of each triangle. This way I have a better view on what I'm doing.
A mesh should also contain indices for indexed drawing, and material data in the form of textures (diffuse/specular maps). Now that we set the minimal requirements for a mesh class we can define a vertex in OpenGL:
The Internal struct is initialised with an instance of an ast::Mesh object. It will actually create two memory buffers through OpenGL - one for all the vertices in our mesh, and one for all the indices. Subsequently it will hold the OpenGL ID handles to these two memory buffers: bufferIdVertices and bufferIdIndices.
The proper way to render in wireframe mode is by changing the OpenGL render state: Hope this helps! :D Awesome that makes a lot of sense thank you! I have a question about the frag shader and the way the textures are identified.
Now that we set the minimal requirements for a mesh class we can define a vertex in OpenGL: We store each of the required vertex attributes in a struct called Vertex. Next to a Vertex struct we also want to organize the texture data in a Texture struct: We store the id of the texture and its type e.g. a diffuse or specular texture.
You can use glPolygonMode()
to disable fills on front and backward facing geometry:
// enable wireframe
glPolygonMode( GL_FRONT, GL_LINE );
// draw stuff to be wireframe'd
DrawStuff();
// restore regular rendering
glPolygonMode( GL_FRONT, GL_FILL );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With