Fix tnl_effects sample not working at all on native desktop OpenGL

This commit is contained in:
UnknownShadow200 2025-02-22 22:41:49 +11:00
parent 0e112ffb3c
commit 6ce38521c9
3 changed files with 6 additions and 4 deletions

View File

@ -301,7 +301,7 @@ static ReadAttributeFunc calcReadDiffuseFunc(void) {
static void _fillZero2f(const GLubyte* __restrict__ input, GLubyte* __restrict__ out) {
_GL_UNUSED(input);
//memset(out, 0, sizeof(float) * 2);
// memset does 8 byte writes - faster to manually write as uint32
// memset does 8 individual byte writes - faster to manually write as uint32
uint32_t* dst = (uint32_t*)out;
dst[0] = 0;
dst[1] = 0;

View File

@ -367,7 +367,6 @@ static void generateElements(
Vertex* output = _glSubmissionTargetStart(target);
VertexExtra* ve = aligned_vector_at(target->extras, 0);
float pos[3], w = 1.0f;
uint32_t i = first;
uint32_t idx = 0;

View File

@ -26,6 +26,7 @@ static void sample_init() {
SDL_Init(SDL_INIT_EVERYTHING);
win_handle = SDL_CreateWindow("Shapes", 0, 0, 640, 480, SDL_WINDOW_OPENGL);
SDL_GL_CreateContext(win_handle);
SDL_GL_SetSwapInterval(1);
#else
glKosInit();
#endif
@ -71,6 +72,8 @@ int main(int argc, char *argv[]) {
texData[i + 3] = 0xFF;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, IMG_SIZE, IMG_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, texData);
float time = 0.0f;
@ -95,7 +98,7 @@ int main(int argc, char *argv[]) {
glLoadIdentity();
glMatrixMode(GL_TEXTURE);
glRotatef(time * 1000, 1, 0, 0);
glRotatef(time * 100, 1, 0, 0);
DrawQuad(1.7f, 0.1f);
glLoadIdentity();
@ -120,7 +123,7 @@ int main(int argc, char *argv[]) {
glLoadIdentity();
glMatrixMode(GL_COLOR);
glRotatef(time * 1000, 1, 0, 0);
glRotatef(time * 100, 1, 0, 0);
DrawQuad(0.1f, 0.5f);
glLoadIdentity();