Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Some codes intializing 'transWidth' and 'transHeight' are ommitted
- static vector<GLfloat> pixels;
- printf("Alloc: %dx%dx4=%d floatsn", transWidth, transHeight, transWidth * transHeight * 4);
- pixels.resize(transWidth * transHeight*4);
- // Some codes modifying 'pixels'
- // omitted
- _CheckErrorGL
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, transWidth, transHeight, 0, GL_RGBA, GL_FLOAT, pixels.data());
- _CheckErrorGL
- #define _CheckErrorGL {
- GLenum code;
- if ((code = glGetError()) != GL_NO_ERROR)
- {
- printf("Error %d: %sn", int(code), gluErrorString(code));
- assert(false);
- }
- }
- Ready for OpenGL 2.0
- Alloc: 732x737x4=2157936 floats
- Alloc: 3168x3224x4=40854528 floats
- Alloc: 732x737x4=2157936 floats
- Alloc: 3168x3224x4=40854528 floats
- Error 1285: 内存不足
- Alloc: 6561x1x4=26244 floats
- Alloc: 732x737x4=2157936 floats
- Alloc: 3168x3224x4=40854528 floats
- Error 1285: 内存不足
- Alloc: 732x737x4=2157936 floats
- Alloc: 3168x3224x4=40854528 floats
- Error 1285: 内存不足
- Alloc: 6561x1x4=26244 floats
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
- 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