Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Hardware/Video/OpenGL/Buffers/FrameBufferObject/glDeferredBufferObject.cpp

Diff revisions: vs.
  @@ -35,50 +35,48 @@
35 35 GLCheck(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_RENDERBUFFER, _depthBufferHandle));
36 36 GLCheck(glBindRenderbuffer(GL_RENDERBUFFER,0));
37 37
38 + GLCheck(glGenTextures(4, _textureId));
39 +
38 40 //Albedo
39 - GLCheck(glGenTextures(1, &_textureId[0]));
40 41 GLCheck(glBindTexture(_textureType, _textureId[0]));
41 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[albedo._magFilter]));
42 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[albedo._minFilter]));
43 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[albedo._wrapU]));
44 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[albedo._wrapV]));
42 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[albedo.getSampler().magFilter()]));
43 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[albedo.getSampler().minFilter()]));
44 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[albedo.getSampler().wrapU()]));
45 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[albedo.getSampler().wrapV()]));
45 46
46 47 GLCheck(glTexImage2D(_textureType, 0, glImageFormatTable[albedo._internalFormat],
47 48 width, height, 0, glImageFormatTable[albedo._format],
48 49 glDataFormat[albedo._dataType], NULL));
49 50
50 51 //Positions
51 - GLCheck(glGenTextures(1, &_textureId[1]));
52 52 GLCheck(glBindTexture(_textureType, _textureId[1]));
53 53
54 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[position._magFilter]));
55 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[position._minFilter]));
56 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[position._wrapU]));
57 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[position._wrapV]));
54 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[position.getSampler().magFilter()]));
55 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[position.getSampler().minFilter()]));
56 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[position.getSampler().wrapU()]));
57 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[position.getSampler().wrapV()]));
58 58
59 59 GLCheck(glTexImage2D(_textureType, 0, glImageFormatTable[position._internalFormat],
60 60 width, height, 0, glImageFormatTable[position._format],
61 61 glDataFormat[position._dataType], NULL));
62 62
63 63 //Normals
64 - GLCheck(glGenTextures(1, &_textureId[2]));
65 64 GLCheck(glBindTexture(_textureType, _textureId[2]));
66 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[normals._magFilter]));
67 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[normals._minFilter]));
68 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[normals._wrapU]));
69 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[normals._wrapV]));
65 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[normals.getSampler().magFilter()]));
66 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[normals.getSampler().minFilter()]));
67 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[normals.getSampler().wrapU()]));
68 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[normals.getSampler().wrapV()]));
70 69
71 70 GLCheck(glTexImage2D(_textureType, 0, glImageFormatTable[normals._internalFormat],
72 71 width, height, 0, glImageFormatTable[normals._format],
73 72 glDataFormat[normals._dataType], NULL));
74 73
75 74 //Blend
76 - GLCheck(glGenTextures(1, &_textureId[3]));
77 - GLCheck(glBindTexture(_textureType, _textureId[3]));
78 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[blend._magFilter]));
79 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[blend._minFilter]));
80 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[blend._wrapU]));
81 - GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[blend._wrapV]));
75 + GLCheck(glBindTexture(_textureType, _textureId[3]));
76 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MAG_FILTER, glTextureFilterTable[blend.getSampler().magFilter()]));
77 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_MIN_FILTER, glTextureFilterTable[blend.getSampler().minFilter()]));
78 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_S, glWrapTable[blend.getSampler().wrapU()]));
79 + GLCheck(glTexParameterf(_textureType, GL_TEXTURE_WRAP_T, glWrapTable[blend.getSampler().wrapV()]));
82 80
83 81 GLCheck(glTexImage2D(_textureType, 0, glImageFormatTable[blend._internalFormat],
84 82 width, height, 0, glImageFormatTable[blend._format],
  @@ -98,10 +96,10 @@
98 96
99 97 void glDeferredBufferObject::Begin(GLubyte nFace) const {
100 98 assert(nFace<6);
101 - GL_API::setViewport(0,0,_width,_height);
99 + GL_API::setViewport(vec4<U32>(0,0,_width,_height));
102 100 GLCheck(glBindFramebuffer(GL_FRAMEBUFFER, _frameBufferHandle));
103 101 GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
104 102 GLCheck(glDrawBuffers(4, buffers));
105 - GLCheck(glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
106 - GL_API::clearColor( 0.0f, 0.0f, 0.0f, 1.0f );
103 + GLCheck(glClear(_clearBufferMask));
104 + GL_API::clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a );
107 105 }