Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Save as test1.cpp and compile with:
- // gcc -I../libsdl/SDL -lSDL -lGL -o test1 test1.cpp
- // run and compare this test with software rendering
- // ./test1
- // LIBGL_ALWAYS_SOFTWARE=1 ./test1
- // red, yellow, pink, and white lines should show.
- // The problem with Nouveau: only red and yellow lines are shown
- // This problem occurs on GL_SHORT or GL_FLOAT, but not GL_INT
- // Hardware: NV44 [GeForce 6200SE TurboCache (TM)] (rev a1)
- #include <SDL/SDL.h>
- #include <SDL/SDL_opengl.h>
- #include <unistd.h>
- int main(int argc, char **argv)
- {
- SDL_Init(SDL_INIT_VIDEO);
- SDL_Surface *screen = SDL_SetVideoMode(512, 384, 0, SDL_OPENGL);
- glScalef(1.0 / 32768, 1.0 / 32768, 1);
- const int array1size = 32;
- short array1[array1size];
- for(int i=0; i < array1size; i++)
- {
- array1[i] = i * 23565 + 25782 + i * i * 2357;
- }
- while(true)
- {
- usleep(20000);
- SDL_Event event;
- while(SDL_PollEvent(&event))
- {
- switch(event.type)
- {
- case SDL_QUIT:
- SDL_Quit();
- return 0;
- break;
- }
- }
- for(int i=0; i < array1size; i++)
- array1[i] += 20 + i * 4;
- glVertexPointer(2, GL_SHORT, 0, array1);
- //int array2[array1size];
- //for(int i=0; i < array1size; i++)
- // array2[i] = array1[i];
- //glVertexPointer(2, GL_INT, 0, array2);
- glClear(GL_COLOR_BUFFER_BIT);
- glEnableClientState(GL_VERTEX_ARRAY);
- for(int i=0; i < array1size/2; i += 4)
- {
- glColor3ub(255,i & 4 ? 255 : 0,i & 8 ? 255 : 0);
- glDrawArrays(GL_LINE_LOOP, i, 4);
- }
- //glDrawArrays(GL_LINE_LOOP, 0, array1size / 2);
- glDisableClientState(GL_VERTEX_ARRAY);
- SDL_GL_SwapBuffers();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment