[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48983] branches/soc-2012-swiss_cheese/ source: Enables draw in VA GE mode for OpenGL ES by using attributes with known index instead of usual functions .
Alexander Kuznetsov
kuzsasha at gmail.com
Mon Jul 16 21:15:26 CEST 2012
Revision: 48983
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48983
Author: alexk
Date: 2012-07-16 19:15:26 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
Enables draw in VA GE mode for OpenGL ES by using attributes with known index instead of usual functions.
Modified Paths:
--------------
branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_functions.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_functions.c
branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_init_exit.c
branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_functions.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_functions.h 2012-07-16 18:34:57 UTC (rev 48982)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_functions.h 2012-07-16 19:15:26 UTC (rev 48983)
@@ -227,7 +227,11 @@
GPUFUNC void (GLAPIENTRY* gpuBindAttribLocation)(GLuint program, GLuint index, const GLchar * name);
GPUFUNC GLint (GLAPIENTRY* gpuGetUniformLocation)(GLuint program, const GLchar * name);
+GPUFUNC void (GLAPIENTRY* gpuVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
+GPUFUNC void (GLAPIENTRY* gpuEnableVertexAttribArray)(GLuint index);
+GPUFUNC void (GLAPIENTRY* gpuDisableVertexAttribArray)(GLuint index);
+
GPUFUNC void (GLAPIENTRY* gpuUseProgram)(GLuint program);
GPUFUNC void (GLAPIENTRY* gpuDeleteShader)(GLuint shader);
GPUFUNC void (GLAPIENTRY* gpuDeleteProgram)(GLuint program);
Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_functions.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_functions.c 2012-07-16 18:34:57 UTC (rev 48982)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_functions.c 2012-07-16 19:15:26 UTC (rev 48983)
@@ -103,6 +103,11 @@
gpuGetAttribLocation = glGetAttribLocationARB;
gpuBindAttribLocation = (void (GLAPIENTRY*)(GLuint,GLuint,const GLchar*))glBindAttribLocationARB;
gpuGetUniformLocation = glGetUniformLocationARB;
+
+ gpuVertexAttribPointer = glVertexAttribPointerARB;
+
+ gpuEnableVertexAttribArray = glEnableVertexAttribArrayARB;
+ gpuDisableVertexAttribArray = glDisableVertexAttribArrayARB;
gpuUseProgram = glUseProgramObjectARB;
gpuDeleteShader = glDeleteObjectARB;
@@ -159,7 +164,12 @@
gpuGetAttribLocation = glGetAttribLocation;
gpuBindAttribLocation = glBindAttribLocation;
gpuGetUniformLocation = glGetUniformLocation;
+
+ gpuVertexAttribPointer = glVertexAttribPointer;
+ gpuEnableVertexAttribArray = glEnableVertexAttribArray;
+ gpuDisableVertexAttribArray = glDisableVertexAttribArray;
+
gpuUseProgram = glUseProgram;
gpuDeleteShader = glDeleteShader;
gpuDeleteProgram = glDeleteProgram;
Modified: branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_init_exit.c 2012-07-16 18:34:57 UTC (rev 48982)
+++ branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_init_exit.c 2012-07-16 19:15:26 UTC (rev 48983)
@@ -108,6 +108,8 @@
#include "GPU_draw.h"
#include "GPU_compatibility.h"
#include "GPU_matrix.h"
+#include "GPU_object.h"
+#include "GPU_functions.h"
#include "BKE_depsgraph.h"
#include "BKE_sound.h"
@@ -186,6 +188,7 @@
GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
GPU_ms_init();
+ GPU_init_object_func();
immediate = gpuNewImmediate();
gpuImmediateMakeCurrent(immediate);
Modified: branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/ghost/GPG_Application.cpp 2012-07-16 18:34:57 UTC (rev 48982)
+++ branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/ghost/GPG_Application.cpp 2012-07-16 19:15:26 UTC (rev 48983)
@@ -100,6 +100,8 @@
#include "GHOST_Rect.h"
#include "GPU_matrix.h"
+#include "GPU_object.h"
+#include "GPU_functions.h"
static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time);
@@ -537,6 +539,8 @@
{
GPU_extensions_init();
GPU_ms_init();
+ GPU_init_object_func();
+
bgl::InitExtensions(true);
// get and set the preferences
Modified: branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp 2012-07-16 18:34:57 UTC (rev 48982)
+++ branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp 2012-07-16 19:15:26 UTC (rev 48983)
@@ -29,11 +29,17 @@
#include <GLES2/gl2.h>
#endif
+#include "GPU_extensions.h"
+
#include "GPU_matrix.h"
#include "RAS_StorageVA.h"
#include "GPU_compatibility.h"
+#include "GPU_material.h"
+#include "GPU_object.h"
+#include "GPU_functions.h"
+
RAS_StorageVA::RAS_StorageVA(int *texco_num, RAS_IRasterizer::TexCoGen *texco, int *attrib_num, RAS_IRasterizer::TexCoGen *attrib) :
m_texco_num(texco_num),
m_texco(texco),
@@ -413,8 +419,13 @@
gpuCurrentColor3x(CPACK_BLACK);
}
- glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ());
- glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal());
+
+ gpuMatrixCommit();
+
+
+ gpugameobj.gpuVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ());
+ gpugameobj.gpuNormalPointer(GL_FLOAT, stride, it.vertex->getNormal());
+
if (!wireframe) {
TexCoordPtr(it.vertex);
if (glIsEnabled(GL_COLOR_ARRAY))
@@ -422,7 +433,10 @@
}
// here the actual drawing takes places
+#include REAL_GL_MODE
+ // here the actual drawing takes places
glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
+#include FAKE_GL_MODE
}
glDisableClientState(GL_VERTEX_ARRAY);
@@ -468,31 +482,31 @@
glClientActiveTextureARB(GL_TEXTURE0_ARB);
}
- if (GLEW_ARB_vertex_program) {
+ if (GPU_EXT_GLSL_VERTEX_ENABLED) {
int uv = 0;
for (unit = 0; unit < *m_attrib_num; unit++) {
switch (m_attrib[unit]) {
case RAS_IRasterizer::RAS_TEXCO_ORCO:
case RAS_IRasterizer::RAS_TEXCO_GLOB:
- glVertexAttribPointerARB(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getXYZ());
+ gpuVertexAttribPointer(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getXYZ());
break;
case RAS_IRasterizer::RAS_TEXCO_UV:
- glVertexAttribPointerARB(unit, 2, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getUV(uv++));
+ gpuVertexAttribPointer(unit, 2, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getUV(uv++));
break;
case RAS_IRasterizer::RAS_TEXCO_NORM:
- glVertexAttribPointerARB(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getNormal());
+ gpuVertexAttribPointer(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getNormal());
break;
case RAS_IRasterizer::RAS_TEXTANGENT:
- glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent());
+ gpuVertexAttribPointer(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent());
break;
case RAS_IRasterizer::RAS_TEXCO_VCOL:
- glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA());
+ gpuVertexAttribPointer(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA());
break;
default:
break;
}
}
- }
+ }
}
void RAS_StorageVA::EnableTextures(bool enable)
@@ -549,7 +563,7 @@
}
}
- if (GLEW_ARB_vertex_program) {
+ if (GPU_EXT_GLSL_VERTEX_ENABLED) {
for (unit = 0; unit < attrib_num; unit++) {
switch (attrib[unit]) {
case RAS_IRasterizer::RAS_TEXCO_ORCO:
@@ -558,11 +572,11 @@
case RAS_IRasterizer::RAS_TEXCO_NORM:
case RAS_IRasterizer::RAS_TEXTANGENT:
case RAS_IRasterizer::RAS_TEXCO_VCOL:
- if (enable) glEnableVertexAttribArrayARB(unit);
- else glDisableVertexAttribArrayARB(unit);
+ if (enable) gpuEnableVertexAttribArray(unit);
+ else gpuDisableVertexAttribArray(unit);
break;
default:
- glDisableVertexAttribArrayARB(unit);
+ gpuDisableVertexAttribArray(unit);
break;
}
}
More information about the Bf-blender-cvs
mailing list