Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Program crashing on draw call with very basic shaders

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2014

    Program crashing on draw call with very basic shaders

    I'm trying to implement shadow maps in my system. When I try to render them with the following:

    Code :
    	for(unsigned int i=0; i<NUMBER_OF_SHADOW_MAP_TO_RENDER; i++){
    		glBindFramebuffer(GL_FRAMEBUFFER, Shadow_i_FBO);
    		for each Mesh to draw
    			const glm::mat4 MVP = currMesh.getModelMatrix() * 
                                                           LIGHT_i_VIEW_PERSPECTIVE_MATRIX; // this is fine, could be identity and still don't work.
    			glBindBuffer(GL_ARRAY_BUFFER, currMesh.positionBuffer);

    Everything that here is abstracted is working singularly (works in other cases).

    The shader program shadowprogram is EXTREMELY basic and is:

    Vertex Shader
    Code :
            #version 330
    		layout(location=0) in vec3 aVertexPosition;
    		uniform mat4 mvpMatrix; 
    		void main(void){
    			gl_Position = mvpMatrix*vec4(aVertexPosition,1.0);
    Fragment Shader
    Code :
            #version 330
    		void main(void){
    There is NO error if I call glGetError() in any part above, but when it reach the draw call (it print before, but not after), the program crashes (violation of access). Also the program links perfectly.
    The thread where it "stops" indicates nvoglv32. To be precise the exception risen says "access violation while reading address 0x00000000." which seemed rather strange to me.
    The same data if called in another way work perfectly.
    On the VS stack call I just have an hexadecimal and nothing else (it says, roughly translated from my french vs, "other frames are missing or wrong").

    It is literally driving me mad, what can be the problem?
    Any help will be GREATLY appreciated

    EDIT: Here the call stack from gDebugger, but still can't understand:

    Keep working with gDebugger I also verified that the correct data are in the VBO that is bind (currMesh.positionBuffer) and has the form that is indicated in the vertexAttribPointer call. But still, the crash occurs anyway. Any indication of what to look for?

    Evidently one vertex attribute was enabled and shouldn't be, so now is fixed.
    Last edited by jafrbc; 06-21-2014 at 09:18 AM.

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2014
    Does ur program work without using a shader? opengl should draw with a default color , for example if i draw without shader it draws white.
    If without shader works well then you are 100% sure the problem is in the shader.
    Also what if you try in the framgent shader to pass over the color?
    #version 330
    out vec4 colorOut;

    void main()
    colorOut = vec4(1.0, 0.0, 0.0, 1.0);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts