issue #1506: implement ShaderTest

This commit is contained in:
minggo 2012-03-21 17:02:52 +08:00
parent bb908f5a5e
commit 92c30a328e
13 changed files with 93 additions and 8 deletions

View File

@ -140,7 +140,7 @@ public:
/** returns the program error log */ /** returns the program error log */
const char* programLog(); const char* programLog();
inline const GLuint& getProgram() { return m_uProgram; } inline const GLuint getProgram() { return m_uProgram; }
private: private:
bool updateUniformLocation(unsigned int location, GLvoid* data, unsigned int bytes); bool updateUniformLocation(unsigned int location, GLvoid* data, unsigned int bytes);

View File

@ -262,7 +262,7 @@ It should work same as apples CFSwapInt32LittleToHost(..)
Increments the GL Draws counts by one. Increments the GL Draws counts by one.
The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled.
*/ */
extern unsigned int g_uNumberOfDraws; extern unsigned int CC_DLL g_uNumberOfDraws;
#define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__
/*******************/ /*******************/

View File

@ -55,6 +55,7 @@ tests/RenderTextureTest/RenderTextureTest.cpp \
tests/RotateWorldTest/RotateWorldTest.cpp \ tests/RotateWorldTest/RotateWorldTest.cpp \
tests/SceneTest/SceneTest.cpp \ tests/SceneTest/SceneTest.cpp \
tests/SchedulerTest/SchedulerTest.cpp \ tests/SchedulerTest/SchedulerTest.cpp \
tests/ShaderTest/ShaderTest.cpp \
tests/SpriteTest/SpriteTest.cpp \ tests/SpriteTest/SpriteTest.cpp \
tests/TextureCacheTest/TextureCacheTest.cpp \ tests/TextureCacheTest/TextureCacheTest.cpp \
tests/Texture2dTest/Texture2dTest.cpp \ tests/Texture2dTest/Texture2dTest.cpp \

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -0,0 +1,10 @@
// http://www.cocos2d-iphone.org
attribute vec4 a_position;
uniform mat4 u_MVPMatrix;
void main()
{
gl_Position = u_MVPMatrix * a_position;
}

View File

@ -335,6 +335,18 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="ShaderTest"
>
<File
RelativePath="..\tests\ShaderTest\ShaderTest.cpp"
>
</File>
<File
RelativePath="..\tests\ShaderTest\ShaderTest.h"
>
</File>
</Filter>
<Filter <Filter
Name="TouchesTest" Name="TouchesTest"
> >
@ -831,10 +843,6 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="ShaderTest"
>
</Filter>
<Filter <Filter
Name="NodeTest" Name="NodeTest"
> >

View File

@ -121,6 +121,9 @@ static TestScene* CreateTestScene(int nIdx)
pScene = new ExtensionsTestScene(); pScene = new ExtensionsTestScene();
} }
break; break;
case TEST_SHADER:
pScene = new ShaderTestScene();
break;
default: default:
break; break;
} }

View File

@ -45,6 +45,7 @@
#include "CurrentLanguageTest/CurrentLanguageTest.h" #include "CurrentLanguageTest/CurrentLanguageTest.h"
#include "TextureCacheTest/TextureCacheTest.h" #include "TextureCacheTest/TextureCacheTest.h"
#include "NodeTest/NodeTest.h" #include "NodeTest/NodeTest.h"
#include "ShaderTest/ShaderTest.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) #if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
#include "ChipmunkTest/cocos2dChipmunkDemo.h" #include "ChipmunkTest/cocos2dChipmunkDemo.h"
@ -103,7 +104,8 @@ enum
TEST_CURRENT_LANGUAGE, TEST_CURRENT_LANGUAGE,
TEST_TEXTURECACHE, TEST_TEXTURECACHE,
TEST_EXTENSIONS, TEST_EXTENSIONS,
TESTS_COUNT, TEST_SHADER,
TESTS_COUNT,
}; };
const std::string g_aTestNames[TESTS_COUNT] = { const std::string g_aTestNames[TESTS_COUNT] = {
@ -149,7 +151,8 @@ const std::string g_aTestNames[TESTS_COUNT] = {
"FontTest", "FontTest",
"CurrentLanguageTest", "CurrentLanguageTest",
"TextureCacheTest", "TextureCacheTest",
"ExtensionsTest" "ExtensionsTest",
"ShaderTest"
}; };
#endif #endif