Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualcifa

Posted 12 May 2013 - 09:11 AM

What do you mean with "nothing shows up"? Does stuff render on the screen if you replace the output color with red for example? I'd suggest to run your program with gDebugger, you can check with it that your texture is loaded correctly and shaders linked. And does that "mypath\green.bmp" really work? \ is used for escape sequences, so I'd suggest you to change it to /

 
 
Yup, if I switch program to one with a fragment shader that output a color, it works.
The path string is a not the real one, it is correct in code biggrin.png
 


i just wonder where is glEnable(GL_TEXUTRE_2D);     ?
 
tell me if that works ;]

 
This is not used with shaders.
 
Some things you can try:
 
As Sponji said, this line is bad:
 
	GLuint tex=loadBMP_custom("mypath\green.bmp");
 
Instead of "mypath\green.bmp" use "mypath\\green.bmp" or "mypath/green.bmp" - the compiler will interpret "\g" as an escape sequence.  The fact that you don't appear ro be error checking this is not a good sign; at the very least you should be checking that you are actually getting a non-zero return value from your loadBMP_custom function.  I wonder what compiler you're using that you're not getting at least a warning from trying to use "\g"?
 
Reduce your fragment shader to an absolute minimum; i.e just a "gl_FragColor = texture(uSampler, vTextureCoord);" line.  If this works then your texture loading is OK and the problem is in your lighting code.  Note that I'm not recommending this as a solution - it's a testing/debugging step.
 
Check that your shaders have compiled and linked successfully.
 
Double-check your source bitmap image.  Is it a power of two?  Is it's width * bpp a multiple of 4?  These are all things that can cause problems.
 
Sprinkle some "assert (glGetError () == GL_NO_ERROR);" calls at key points in your code - after texture loading, shader compilation, vertex setup, etc.  Run in the debugger and ensure that everything works without internal GL errors.


 
As I told to Sponji, the path is not written that way in code. 
The same shader without the texture stuff, works fine. I've a specular code with everything that's the same, except for the texture stuff, so I'm pretty sure that my problem is there.
Oh and the .bmp is fine! 
I'll play around with assert now biggrin.png
 
 
Thank you both for your answer.
 
 
 
EDIT: 
 
It appears that I'm a was a little to drowsy when I was writing my initShader function, I was searching for the texture coord attribute into the wrong program (I have 3 of them, one of those without texture).
Thank you for your support and I'm sorry for the lost of time biggrin.png

#2cifa

Posted 12 May 2013 - 08:53 AM

What do you mean with "nothing shows up"? Does stuff render on the screen if you replace the output color with red for example? I'd suggest to run your program with gDebugger, you can check with it that your texture is loaded correctly and shaders linked. And does that "mypath\green.bmp" really work? \ is used for escape sequences, so I'd suggest you to change it to /

 

 

Yup, if I switch program to one with a fragment shader that output a color, it works.

The path string is a not the real one, it is correct in code biggrin.png

 

i just wonder where is glEnable(GL_TEXUTRE_2D);     ?

 

tell me if that works ;]

 

This is not used with shaders.

 

Some things you can try:

 

As Sponji said, this line is bad:

 

	GLuint tex=loadBMP_custom("mypath\green.bmp");

 

Instead of "mypath\green.bmp" use "mypath\\green.bmp" or "mypath/green.bmp" - the compiler will interpret "\g" as an escape sequence.  The fact that you don't appear ro be error checking this is not a good sign; at the very least you should be checking that you are actually getting a non-zero return value from your loadBMP_custom function.  I wonder what compiler you're using that you're not getting at least a warning from trying to use "\g"?

 

Reduce your fragment shader to an absolute minimum; i.e just a "gl_FragColor = texture(uSampler, vTextureCoord);" line.  If this works then your texture loading is OK and the problem is in your lighting code.  Note that I'm not recommending this as a solution - it's a testing/debugging step.

 

Check that your shaders have compiled and linked successfully.

 

Double-check your source bitmap image.  Is it a power of two?  Is it's width * bpp a multiple of 4?  These are all things that can cause problems.

 

Sprinkle some "assert (glGetError () == GL_NO_ERROR);" calls at key points in your code - after texture loading, shader compilation, vertex setup, etc.  Run in the debugger and ensure that everything works without internal GL errors.

 

As I told to Sponji, the path is not written that way in code. 

The same shader without the texture stuff, works fine. I've a specular code with everything that's the same, except for the texture stuff, so I'm pretty sure that my problem is there.

Oh and the .bmp is fine! 

I'll play around with assert now :D 

 

 

Thank you both for your answer


#1cifa

Posted 12 May 2013 - 08:46 AM

What do you mean with "nothing shows up"? Does stuff render on the screen if you replace the output color with red for example? I'd suggest to run your program with gDebugger, you can check with it that your texture is loaded correctly and shaders linked. And does that "mypath\green.bmp" really work? \ is used for escape sequences, so I'd suggest you to change it to /

 

 

Yup, if I switch program to one with a fragment shader that output a color, it works.

The path string is a not the real one, it is correct in code :D 

 

i just wonder where is glEnable(GL_TEXUTRE_2D);     ?

 

tell me if that works ;]

 

This is not used with shaders.

 

Some things you can try:

 

As Sponji said, this line is bad:

 

	GLuint tex=loadBMP_custom("mypath\green.bmp");

 

Instead of "mypath\green.bmp" use "mypath\\green.bmp" or "mypath/green.bmp" - the compiler will interpret "\g" as an escape sequence.  The fact that you don't appear ro be error checking this is not a good sign; at the very least you should be checking that you are actually getting a non-zero return value from your loadBMP_custom function.  I wonder what compiler you're using that you're not getting at least a warning from trying to use "\g"?

 

Reduce your fragment shader to an absolute minimum; i.e just a "gl_FragColor = texture(uSampler, vTextureCoord);" line.  If this works then your texture loading is OK and the problem is in your lighting code.  Note that I'm not recommending this as a solution - it's a testing/debugging step.

 

Check that your shaders have compiled and linked successfully.

 

Double-check your source bitmap image.  Is it a power of two?  Is it's width * bpp a multiple of 4?  These are all things that can cause problems.

 

Sprinkle some "assert (glGetError () == GL_NO_ERROR);" calls at key points in your code - after texture loading, shader compilation, vertex setup, etc.  Run in the debugger and ensure that everything works without internal GL errors.

 

As I told to Sponji, the path is not written that way in code. 

The same shader without the texture stuff, works fine. I've a specular code with everything that's the same, except for the texture stuff, so I'm pretty sure that my problem is there.

Oh and the .bmp is fine! 

 

 

 

Thank you both for your answer


PARTNERS