opengl texture problem

BlitzMax Forums/OpenGL Module/opengl texture problem

Polan(Posted 2011) [#1]
I'm trying to learn opengl 3.3 and I'm having problem with textures.
My Fragment shader. When I use texture(texture,uv) it won't render anything. When I put anythnig else in outColor I get correct results.
#version 330

in vec4 fragColor;
in vec2 fragCoord;

out vec4 outColor;

uniform sampler2D fragTex;

void main(void)
	{
	outColor = texture(fragTex,fragCoord);
	}

I create texture like that. With old rendering way (opengl 2.1 <) it display correct.
	If pixmap.format<>PF_RGBA8888 pixmap=pixmap.Convert(PF_RGBA8888)
	Local width:Int=pixmap.width,height:Int=pixmap.height
	GLAdjustTexSize width,height
	If width<>pixmap.width Or height<>pixmap.height pixmap=ResizePixmap(pixmap,width,height)
	Local name:Int
	glGenTextures(1,Varptr name)
	glBindTexture(GL_TEXTURE_2D,name)
	If filter > 2 Then filter = 2
	If filter < 1 Then filter = 1
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,filter)
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,filter)
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT)
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT)
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,anisotropy)
	glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.pixels)
	glGenerateMipmap(GL_TEXTURE_2D)
	Return name

To get texture sampler location I use. Note: shader program is linked at this stage.
plW.pr[shaderprogram].TextureLoc = glGetUniformLocation(plW.pr[shaderprogram].program,"fragTex")

Then in render part I active shader program and use this to bind texture:
	glUniform1i(plW.pr[plW.actpr].TextureLoc,0)
	glActiveTexture(GL_TEXTURE0)
	glBindTexture(GL_TEXTURE_2D,plW.tex[tex].tex[0])

There is no debug logs from shader, no glgeterror. Any idea/help?


col(Posted 2011) [#2]
sorry. never mind.

Last edited 2011