Hello,
So I’m trying to switch this cool SFML project to SDL and I’m not exactly sure if it’s possible. https://github.com/xSnapi/Isometric-Terrain
All I’m trying to do at the moment is just make an isometric cube. I thought I could do it using SDL_Vertex and SDL_RenderGeometry, but I’m not sure if I can do it without OpenGL.
Here is where I started.
void AddCube(Vector2f position, float size, SDL_Color color, Vector2f texCoords) {
size /= 2.0f;
SDL_Vertex v[6] =
{
{ SDL_FPoint{-size, 0.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
{ SDL_FPoint{size, 0.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
{ SDL_FPoint{size, size * 2.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
{ SDL_FPoint{-size, 0.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
{ SDL_FPoint{-size, size * 2.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
{ SDL_FPoint{size, size * 2.0f} + position, color, SDL_FPoint(texCoords.x, texCoords.y) },
};
for (uint32_t i = 0; i < 6; i++) {
m_Vertices.push_back(v[i]);
}
}
...
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
SDL_RenderGeometry(renderer, nullptr, m_Vertices.data(), m_Vertices.size(), nullptr, 0);
SDL_RenderPresent(renderer);
PS: All I get is a red square.