Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. // Some codes intializing 'transWidth' and 'transHeight' are ommitted
  2. static vector<GLfloat> pixels;
  3.  
  4. printf("Alloc: %dx%dx4=%d floatsn", transWidth, transHeight, transWidth * transHeight * 4);
  5. pixels.resize(transWidth * transHeight*4);
  6. // Some codes modifying 'pixels'
  7. // omitted
  8.  
  9. _CheckErrorGL
  10. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, transWidth, transHeight, 0, GL_RGBA, GL_FLOAT, pixels.data());
  11. _CheckErrorGL
  12.  
  13. #define _CheckErrorGL {
  14. GLenum code;
  15. if ((code = glGetError()) != GL_NO_ERROR)
  16. {
  17. printf("Error %d: %sn", int(code), gluErrorString(code));
  18. assert(false);
  19. }
  20. }
  21.  
  22. Ready for OpenGL 2.0
  23. Alloc: 732x737x4=2157936 floats
  24. Alloc: 3168x3224x4=40854528 floats
  25. Alloc: 732x737x4=2157936 floats
  26. Alloc: 3168x3224x4=40854528 floats
  27. Error 1285: 内存不足
  28. Alloc: 6561x1x4=26244 floats
  29. Alloc: 732x737x4=2157936 floats
  30. Alloc: 3168x3224x4=40854528 floats
  31. Error 1285: 内存不足
  32. Alloc: 732x737x4=2157936 floats
  33. Alloc: 3168x3224x4=40854528 floats
  34. Error 1285: 内存不足
  35. Alloc: 6561x1x4=26244 floats
  36.  
  37. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  38. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  39. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  40. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  41. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
  42.  
  43. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, transWidth, transHeight, 0, GL_RGBA, GL_FLOAT, pixels.data());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement