MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / opengl_MakeWrapTypeCurrent

Function opengl_MakeWrapTypeCurrent

renderer/HardwareOpenGL.cpp:1141–1186  ·  view source on GitHub ↗

Sets up an appropriate wrap type for the current bound texture

Source from the content-addressed store, hash-verified

1139
1140// Sets up an appropriate wrap type for the current bound texture
1141void opengl_MakeWrapTypeCurrent(int handle, int map_type, int tn) {
1142 int uwrap;
1143 wrap_type dest_wrap;
1144
1145 if (tn == 1)
1146 dest_wrap = WT_CLAMP;
1147 else
1148 dest_wrap = gpu_state.cur_wrap_type;
1149
1150 if (map_type == MAP_TYPE_LIGHTMAP)
1151 uwrap = GET_WRAP_STATE(OpenGL_lightmap_states[handle]);
1152 else
1153 uwrap = GET_WRAP_STATE(OpenGL_bitmap_states[handle]);
1154
1155 if (uwrap == dest_wrap)
1156 return;
1157
1158 if (UseMultitexture && Last_texel_unit_set != tn) {
1159#if (defined(_USE_OGL_ACTIVE_TEXTURES))
1160 oglActiveTextureARB(GL_TEXTURE0_ARB + tn);
1161 Last_texel_unit_set = tn;
1162#endif
1163 }
1164
1165 OpenGL_sets_this_frame[1]++;
1166
1167 if (gpu_state.cur_wrap_type == WT_CLAMP) {
1168 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1169 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1170
1171 } else if (gpu_state.cur_wrap_type == WT_WRAP_V) {
1172 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1173 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1174 } else {
1175 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1176 dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1177 }
1178
1179 if (map_type == MAP_TYPE_LIGHTMAP) {
1180 SET_WRAP_STATE(OpenGL_lightmap_states[handle], dest_wrap);
1181 } else {
1182 SET_WRAP_STATE(OpenGL_bitmap_states[handle], dest_wrap);
1183 }
1184
1185 CHECK_ERROR(8)
1186}
1187
1188// Chooses the correct filter type for the currently bound texture
1189void opengl_MakeFilterTypeCurrent(int handle, int map_type, int tn) {

Callers 1

gpu_BindTextureFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected