bglTexFromPixmap :(

BlitzMax Forums/OpenGL Module/bglTexFromPixmap :(

Skurcey(Posted 2005) [#1]
i wrote this but the texture won t draw, what can i do, please?
bglCreateContext 800,600,16,60,BGL_BACKBUFFER | BGL_DEPTHBUFFER 'BGL_FULLSCREEN|
glEnable GL_TEXTURE_2D
glShadeModel(GL_SMOOTH)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
glEnable GL_DEPTH_TEST
glMatrixMode GL_PROJECTION
glLoadIdentity()
glFrustum -0.1, 0.1,-0.1, 0.1, 0.1, 100.0
glMatrixMode GL_MODELVIEW
glLoadIdentity()

Global camX:Int=.2,camY:Int=0,camZ:Int=-4

Global space:TPixmap=LoadPixmap("img/space1.bmp")
Global tex_space:Int=bglTexFromPixmap(space,True)
glBindTexture (GL_TEXTURE_2D,tex_space)




Local rot_cube:Float
While Not KeyHit(KEY_ESCAPE)
	rot_cube:+.01
	If rot_cube>360 rot_cube:-360
	glClear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
	
	draw_cube(0,0,0, rot_cube,rot_cube,Rnd(.01))
	bglDrawText ("Hello",0,0)	
	bglSwapBuffers
Wend

Function draw_cube(Px:Float=0,Py:Float=0,Pz:Float=0,  Rx:Float=0,Ry:Float=0,Rz:Float=0)
	glLoadIdentity()	
		glTranslatef px+camX,py+camY,pz+camZ
		glRotatef Rx,1,0,0
		glRotatef Ry,0,1,0
		glRotatef Rz,0,0,1	
		glBindTexture (GL_TEXTURE_2D,tex_space)	
	glBegin GL_QUADS		
		
		glColor3f .3,.3,.3'bottom
		glVertex3f -1,-1,-1
		glVertex3f -1,-1,1
		glVertex3f 1,-1,1
		glVertex3f 1,-1,-1
		
		glColor3f 1,1,1'Top
		glVertex3f -1,1,-1
		glVertex3f -1,1,1
		glVertex3f 1,1,1
		glVertex3f 1,1,-1
		
		glColor3f .8,.6,.6'Left
		glVertex3f -1,1,-1
		glVertex3f -1,1,1
		glVertex3f -1,-1,1
		glVertex3f -1,-1,-1
		
		glColor3f .6,.6,.8'Right
		glVertex3f 1,1,-1
		glVertex3f 1,1,1
		glVertex3f 1,-1,1
		glVertex3f 1,-1,-1

		glColor3f .6,.6,.6'back
		glVertex3f -1,1,-1
		glVertex3f 1,1,-1
		glVertex3f 1,-1,-1
		glVertex3f -1,-1,-1
		
		glColor3f .8,.8,.8'back
		glVertex3f -1,1,1
		glVertex3f 1,1,1
		glVertex3f 1,-1,1
		glVertex3f -1,-1,1
	
	glEnd
		
		
End Function



LeisureSuitLurie(Posted 2005) [#2]
You need to provide texture coordinates before each vertex with gltexcoord2d...


Skurcey(Posted 2005) [#3]
Oups sorry to had disturb you for a so dumb question, the response was just in front of my eyes, but thanks anyway


LeisureSuitLurie(Posted 2005) [#4]
No problem. All those GL functions GL_LOOK_ALIKE_AFTER_AWHILE.

:p