3D OpenGL Engine

BlitzPlus Forums/BlitzPlus Programming/3D OpenGL Engine

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Todd: you can use the second uv map for lightmaps with vertex arrays, the easiest way to do it though is by using the multitexture GL extension.
	glNormalPointer(gl_float,0,q3\normals)  ; setup normals
	glVertexPointer(3,GL_float,0,q3\vertices) ; setup verts
	glClientActiveTextureARB(GL_TEXTURE0_ARB); ; Set the client Texture to be the first of the 8 multi textures
	glTexCoordPointer(2,GL_FLOAT,0,q3\uv[0]) ; Setup the texcord pointers for this texture
	glClientActiveTextureARB(GL_TEXTURE1_ARB); ; set the second texture to be the active one.
	glTexCoordPointer(2,GL_FLOAT,0,q3\uv[1]) ; setup the tex cord array for this texture.
	glEnableClientState(GL_TEXTURE_COORD_ARRAY); enable the array
      ; The next few lines were for turning on and off the textures so you could see them with out detail map.
; (ie only lightmap) or turn off the detail map. if they both are '1' then they are both enabled.
	If tex1=1
		glClientActiveTextureARB(GL_TEXTURE0_ARB); 
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	EndIf
	If tex2=1
		glClientActiveTextureARB(GL_TEXTURE1_ARB);
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	EndIf
... 
Some Vis stuff to do with quake3 bsps.
...
If tex1=1
			glActiveTextureARB(GL_TEXTURE0_ARB);
			glEnable(GL_texture_2d)
			glBindTexture(GL_TEXTURE_2D,(PeekInt(q3\tex,(texid*8))))
		EndIf
		If tex2=1
			glActiveTextureARB(GL_TEXTURE1_ARB);
			glEnable(GL_texture_2d)
			glBindTexture(GL_TEXTURE_2D,(PeekInt(q3\tex,(Lmap*8)+4)))
		EndIf
		If typ=1
			glDrawArrays(GL_TRIANGLE_FAN,vin,nver)
		Else typ=2
			glDrawArrays(GL_POLYGON,vin,nver)
		EndIf