Rendering a list of objects with the same mesh.

Hey.
Im using LibGDX + Ashley (ECS) and im trying to draw a list of tiles(entities) with one mesh (each tile has a texture offset and height - for scaling along the y axis).
The problem : nothing shows up on the screen and i have no idea why. I suppose i messed something up with OpenGL calls, as this is my first attempt at 3D.
If you have a better solution than what i have come up with, feel free to share it :slight_smile:

TileRenderSystem.java
Test1.java (Loop Class)
tilesVertexShader.txt
tilesFragmentShader.txt
EDIT: defaultTileSet.png

Please help me :c Can you guys at least show me some way to do it? I don’t need code, just some tips. All im trying to do is render a mesh multiple times, with different scale, and different “texture offset”.

When you have issues, the first thing you need to do is call [icode]glGetError[/icode], because if OpenGL is having a hissyfit because you’re new to GL, you would never know without retrieving the error. Typically when you’re not seeing anything, it’s either because you’re not actually rendering anything, you’re not rendering anything onscreen (i.e your viewing frustrum is looking in the wrong direction), or OpenGL is having issues.

If you are having GL errors, you must definitely familiarize yourself with the core API reference. Making a post to StackOverflow saying “Opengl is returning error 1281” is pretty pointless because just about every OpenGL call you make can throw all of the errors for different reasons.

When GL throws an error follow these steps:

  • Identify which OpenGL call is throwing the error.
  • Go to the core API reference page for the call. At the bottom of each page, it defines the various reasons why an error may be thrown.
  • Fix your issue. If you are still having problems doing this, you may now post to StackOverflow or JGO or wherever you typically seek help.

When identifying which GL call is throwing the error, you can really do nothing but call [icode]glGetError[/icode] after each GL call. Please note that you need to identify which is the earliest GL call that is throwing the error, because [icode]glGetError[/icode] only holds the most recent error thrown, and if an error is thrown by one call, a later call may throw another error because of the first error, especially if there is a problem in setting a state (OpenGL is a very state based system).

Generally, GL throws one of three errors:
[icode]GL_INVALID_ENUM[/icode] [b](Error 0x500 / Error 1280)[/b]
[icode]GL_INVALID_VALUE[/icode] [b](Error 0x501 / Error 1281)[/b]
[icode]GL_INVALID_OPERATION[/icode] [b](Error 0x502 / Error 1282)[/b]

Thanks :slight_smile: i will let you know when i find the issue.