[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49317] branches/soc-2012-swiss_cheese/ source/blender/gpu: Adding more OpenGL-like functions for object manipulation

Alexander Kuznetsov kuzsasha at gmail.com
Sat Jul 28 04:38:52 CEST 2012


Revision: 49317
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49317
Author:   alexk
Date:     2012-07-28 02:38:47 +0000 (Sat, 28 Jul 2012)
Log Message:
-----------
Adding more OpenGL-like functions for object manipulation
gpuTexCoordPointer = glTexCoordPointer
gpuClientActiveTexture = glClientActiveTexture

Now, in gl11 implementation, calling any  gl*Pointer enables GL_*_ARRAY with glEnableClientState;
So, no need to call glEnableClientState
gpuCleanupAfterDraw must be called after glDraw* function to disable any enabled GL_*_ARRAY and reset internal state

In GLES functions gpuTexCoordPointer and gpuClientActiveTexture aren't yet implemented

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_object.h
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.h
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.h

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_object.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_object.h	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_object.h	2012-07-28 02:38:47 UTC (rev 49317)
@@ -1,8 +1,14 @@
 typedef struct GPU_object_func
 {
-	void (*gpuVertexPointer)(int size, int type, int stride, const void *pointer);
-	void (*gpuNormalPointer)(          int type, int stride, const void *pointer);
-	void (*gpuColorPointer )(int size, int type, int stride, const void *pointer);	
+	void (*gpuVertexPointer)  (int size, int type, int stride, const void *pointer);
+	void (*gpuNormalPointer)  (          int type, int stride, const void *pointer);
+	void (*gpuColorPointer )  (int size, int type, int stride, const void *pointer);
+	void (*gpuTexCoordPointer)(int size, int type, int stride, const void *pointer);
+
+	void (*gpuClientActiveTexture)(int texture);
+	void (*gpuCleanupAfterDraw)(void);
+
+
 } GPU_object_func;
 
 
@@ -17,4 +23,4 @@
 
 #ifdef __cplusplus
 }
-#endif
\ No newline at end of file
+#endif

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object.c	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object.c	2012-07-28 02:38:47 UTC (rev 49317)
@@ -15,14 +15,21 @@
 gpugameobj.gpuVertexPointer = gpuVertexPointer_gles;
 gpugameobj.gpuNormalPointer = gpuNormalPointer_gles;
 gpugameobj.gpuColorPointer = gpuColorPointer_gles;
+gpugameobj.gpuTexCoordPointer = gpuTexCoordPointer_gles;
+gpugameobj.gpuClientActiveTexture = gpuClientActiveTexture_gles;
 
+gpugameobj.gpuCleanupAfterDraw = gpuCleanupAfterDraw_gles;
 
 #else
 
 gpugameobj.gpuVertexPointer = gpuVertexPointer_gl11;
 gpugameobj.gpuNormalPointer = gpuNormalPointer_gl11;
 gpugameobj.gpuColorPointer = gpuColorPointer_gl11;
+gpugameobj.gpuTexCoordPointer = gpuTexCoordPointer_gl11;
+gpugameobj.gpuClientActiveTexture = gpuClientActiveTexture_gl11;
 
+gpugameobj.gpuCleanupAfterDraw = gpuCleanupAfterDraw_gl11;
+
 #endif
 
 

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.c	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.c	2012-07-28 02:38:47 UTC (rev 49317)
@@ -5,27 +5,69 @@
 
 
 
+struct GPU_object_gl11_data
+{
+		char norma;
+		char cola;	char texta;
 
+} static od = {0};
 
+
+
 void gpuVertexPointer_gl11(int size, int type, int stride, const void *pointer)
 {
-		glVertexPointer(size, type, stride, pointer);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(size, type, stride, pointer);
 }
 
 void gpuNormalPointer_gl11(int type, int stride, const void *pointer)
 {
-		glNormalPointer(type, stride, pointer);
+	glEnableClientState(GL_NORMAL_ARRAY); od.norma = 1;
+	glNormalPointer(type, stride, pointer);
 
 }
 
 void gpuColorPointer_gl11 (int size, int type, int stride, const void *pointer)
 {
 
+	glEnableClientState(GL_COLOR_ARRAY); od.cola = 1;
+	glColorPointer(size, type, stride, pointer);
 
 
 
+}
 
+void gpuTexCoordPointer_gl11(int size, int type, int stride, const void *pointer)
+{
+	if(od.texta==0)
+	{
+		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+		od.texta = 1;
 
+	}
+	glTexCoordPointer(size, type, stride, pointer);
+
 }
 
+void gpuClientActiveTexture_gl11(int texture)
+{
+	glClientActiveTexture(texture);
+}
+
+void gpuCleanupAfterDraw_gl11(void)
+{
+	glDisableClientState(GL_VERTEX_ARRAY);
+
+	if(od.norma)
+		glDisableClientState(GL_NORMAL_ARRAY);
+	if(od.cola)
+		glDisableClientState(GL_COLOR_ARRAY);
+	if(od.texta)
+		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
+	od.norma = 0;
+	od.cola = 0;
+	od.texta = 0;
+}
+
 #endif

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.h	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gl11.h	2012-07-28 02:38:47 UTC (rev 49317)
@@ -3,5 +3,9 @@
 void gpuVertexPointer_gl11(int size, int type, int stride, const void *pointer);
 void gpuNormalPointer_gl11(          int type, int stride, const void *pointer);
 void gpuColorPointer_gl11 (int size, int type, int stride, const void *pointer);	 
+void gpuTexCoordPointer_gl11(int size, int type, int stride, const void *pointer);
+void gpuClientActiveTexture_gl11(int texture);
 
+void gpuCleanupAfterDraw_gl11(void);
+
 #endif

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.c	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.c	2012-07-28 02:38:47 UTC (rev 49317)
@@ -40,6 +40,25 @@
 
 }
 
+void gpuTexCoordPointer_gles(int size, int type, int stride, const void *pointer)
+{
+
+
+
+}
+
+
+void gpuClientActiveTexture_gles(int texture)
+{
+
+}
+
+void gpuCleanupAfterDraw_gles(void)
+{
+
+
+}
+
 void gpu_set_shader_es(struct GPUGLSL_ES_info * s, int update)
 {
 	curglslesi = s;

Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.h	2012-07-28 01:14:36 UTC (rev 49316)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_object_gles.h	2012-07-28 02:38:47 UTC (rev 49317)
@@ -25,9 +25,13 @@
 
 void gpuVertexPointer_gles(int size, int type, int stride, const void *pointer);
 void gpuNormalPointer_gles(          int type, int stride, const void *pointer);
-void gpuColorPointer_gles (int size, int type, int stride, const void *pointer);	 
+void gpuColorPointer_gles (int size, int type, int stride, const void *pointer);
+void gpuTexCoordPointer_gles(int size, int type, int stride, const void *pointer);
+void gpuClientActiveTexture_gles(int texture);
 
+void gpuCleanupAfterDraw_gles(void);
 
+
 #ifdef __cplusplus 
 }
 #endif




More information about the Bf-blender-cvs mailing list