dbacchet avatar dbacchet committed 0f56d3d

started working on texture

Comments (0)

Files changed (3)

temp/test_hordefiles/egRenderer.cpp

 					gRDI->setTexture( shaderRes->_samplers[i].texUnit,
 					                  gRDI->getRenderBufferTex( texRes->getRBObject(), 0 ), sampState );
 				}
-				else  // Trying to bind active render buffer as texture
-				{
-					gRDI->setTexture( shaderRes->_samplers[i].texUnit, TextureResource::defTex2DObject, 0 );
-				}
+				// else  // Trying to bind active render buffer as texture
+				// {
+				// 	gRDI->setTexture( shaderRes->_samplers[i].texUnit, TextureResource::defTex2DObject, 0 );
+				// }
 			}
 			else
 			{

temp/test_hordefiles/egTexture.cpp

 
 unsigned char *TextureResource::mappedData = 0x0;
 int TextureResource::mappedWriteImage = -1;
-uint32_t TextureResource::defTex2DObject = 0;
-uint32_t TextureResource::defTex3DObject = 0;
-uint32_t TextureResource::defTexCubeObject = 0;
-
-
-void TextureResource::initializationFunc()
-{
-	unsigned char texData[] = 
-		{ 128,192,255,255, 128,192,255,255, 128,192,255,255, 128,192,255,255,
-		  128,192,255,255, 128,192,255,255, 128,192,255,255, 128,192,255,255,
-		  128,192,255,255, 128,192,255,255, 128,192,255,255, 128,192,255,255,
-		  128,192,255,255, 128,192,255,255, 128,192,255,255, 128,192,255,255 };
-
-	// Upload default textures
-	defTex2DObject = gRDI->createTexture( TextureTypes::Tex2D, 4, 4, 1,
-	                                      TextureFormats::BGRA8, true, true );
-	gRDI->uploadTextureData( defTex2DObject, 0, 0, texData );
-	
-	defTexCubeObject = gRDI->createTexture( TextureTypes::TexCube, 4, 4, 1,
-	                                        TextureFormats::BGRA8, true, true );
-	for( uint32_t i = 0; i < 6; ++i ) 
-	{
-		gRDI->uploadTextureData( defTexCubeObject, i, 0, texData );
-	}
-
-	unsigned char *texData2 = new unsigned char[256];
-	memcpy( texData2, texData, 64 ); memcpy( texData2 + 64, texData, 64 );
-	memcpy( texData2 + 128, texData, 64 ); memcpy( texData2 + 192, texData, 64 );
-
-	defTex3DObject = gRDI->createTexture( TextureTypes::Tex3D, 4, 4, 4,
-	                                      TextureFormats::BGRA8, true, true );
-	gRDI->uploadTextureData( defTex3DObject, 0, 0, texData2 );
-	delete[] texData2;
-}
-
-
-void TextureResource::releaseFunc()
-{
-	gRDI->destroyTexture( defTex2DObject );
-	gRDI->destroyTexture( defTex3DObject );
-	gRDI->destroyTexture( defTexCubeObject );
-}
+// uint32_t TextureResource::defTex2DObject = 0;
+// uint32_t TextureResource::defTex3DObject = 0;
+// uint32_t TextureResource::defTexCubeObject = 0;
 
 
 TextureResource::TextureResource( const string &name, int flags ) :
 	_width = 0; _height = 0; _depth = 0;
 	_hasMipMaps = true;
 	
-	if( _texType == TextureTypes::TexCube )
-		_texObject = defTexCubeObject;
-	else if( _texType == TextureTypes::Tex3D )
-		_texObject = defTex3DObject;
-	else
-		_texObject = defTex2DObject;
+	_texObject = 0;
+	// if( _texType == TextureTypes::TexCube )
+	// 	_texObject = defTexCubeObject;
+	// else if( _texType == TextureTypes::Tex3D )
+	// 	_texObject = defTex3DObject;
+	// else
+	// 	_texObject = defTex2DObject;
 }
 
 
 		// In this case _texObject is just points to the render buffer
 		gRDI->destroyRenderBuffer( _rbObj );
 	}
-	else if( _texObject != 0 && _texObject != defTex2DObject && _texObject != defTexCubeObject )
+	else if( _texObject != 0 )
 	{
 		gRDI->destroyTexture( _texObject );
 	}

temp/test_hordefiles/egTexture.h

 class TextureResource : public Resource
 {
 public:
-	static void initializationFunc();
-	static void releaseFunc();
+
 	static Resource *factoryFunc( const std::string &name, int flags )
 		{ return new TextureResource( name, flags ); }
 	
 	uint32_t getRBObject()  { return _rbObj; }
 	bool hasMipMaps() { return _hasMipMaps; }
 
-public:
-	static uint32_t defTex2DObject;
-	static uint32_t defTex3DObject;
-	static uint32_t defTexCubeObject;
-
 protected:
 	bool raiseError( const std::string &msg );
 	bool checkDDS( const char *data, int size );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.