Move render target texture parameters to renderer gl
This commit is contained in:
@@ -38,6 +38,12 @@ constexpr std::uint32_t gl_texture_cube_map_positive_y = 0x8517U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_negative_y = 0x8518U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_positive_z = 0x8519U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_negative_z = 0x851AU;
|
||||
constexpr std::uint32_t gl_linear = 0x2601U;
|
||||
constexpr std::uint32_t gl_texture_mag_filter = 0x2800U;
|
||||
constexpr std::uint32_t gl_texture_min_filter = 0x2801U;
|
||||
constexpr std::uint32_t gl_texture_wrap_s = 0x2802U;
|
||||
constexpr std::uint32_t gl_texture_wrap_t = 0x2803U;
|
||||
constexpr std::uint32_t gl_clamp_to_edge = 0x812FU;
|
||||
|
||||
[[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept
|
||||
{
|
||||
@@ -195,4 +201,16 @@ std::uint32_t cube_face_texture_target(std::uint32_t face_index) noexcept
|
||||
return targets[face_index];
|
||||
}
|
||||
|
||||
std::span<const OpenGlTextureParameter> default_render_target_texture_parameters() noexcept
|
||||
{
|
||||
static constexpr std::array<OpenGlTextureParameter, 4> parameters {
|
||||
OpenGlTextureParameter { .name = gl_texture_mag_filter, .value = gl_linear },
|
||||
OpenGlTextureParameter { .name = gl_texture_min_filter, .value = gl_linear },
|
||||
OpenGlTextureParameter { .name = gl_texture_wrap_s, .value = gl_clamp_to_edge },
|
||||
OpenGlTextureParameter { .name = gl_texture_wrap_t, .value = gl_clamp_to_edge },
|
||||
};
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ struct OpenGlPixelFormat {
|
||||
std::uint32_t channel_count = 0;
|
||||
};
|
||||
|
||||
struct OpenGlTextureParameter {
|
||||
std::uint32_t name = 0;
|
||||
std::uint32_t value = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
@@ -38,5 +43,6 @@ struct OpenGlPixelFormat {
|
||||
[[nodiscard]] std::uint32_t primitive_mode_for_stroke_count(std::uint32_t vertex_or_index_count) noexcept;
|
||||
[[nodiscard]] std::span<const std::uint32_t> panopainter_cube_face_texture_targets() noexcept;
|
||||
[[nodiscard]] std::uint32_t cube_face_texture_target(std::uint32_t face_index) noexcept;
|
||||
[[nodiscard]] std::span<const OpenGlTextureParameter> default_render_target_texture_parameters() noexcept;
|
||||
|
||||
}
|
||||
|
||||
11
src/rtt.cpp
11
src/rtt.cpp
@@ -213,10 +213,13 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
|
||||
glBindTexture(GL_TEXTURE_2D, texID);
|
||||
if (tex == -1)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, GL_RGBA, ifmt, 0);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
for (const auto parameter : pp::renderer::gl::default_render_target_texture_parameters())
|
||||
{
|
||||
glTexParameterf(
|
||||
GL_TEXTURE_2D,
|
||||
static_cast<GLenum>(parameter.name),
|
||||
static_cast<GLfloat>(parameter.value));
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Create a renderbuffer object to store depth info
|
||||
|
||||
Reference in New Issue
Block a user