Sign in to follow this  

OpenGL Strange rendering behavior on different cards.

This topic is 1373 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone.

I'm facing a quite strange problem.

 

I'm initializing my OpenGL context with SDL2-2.0.3, forcing it to use the core profile ( 3.3 ), also I am using GLEW for extensions. I am using Linux Mint 16 with stock kernel 3.11.0-12-generic with proprietary nvidia drivers from the repos ( version 319.32 ).

 

I've got the same setup on two different machines:

 

Lenovo V580c laptop with GeForce 740M

and

PC with GeForce GT 630.

Also, I've got another PC with AMD Radeon HD 6670 card ( OS - Debian  + opensource driver )

 

My OpenGL application for now renders only one rotating triangle in perpective projection with FPS-like camera floating around.

 

 

The problem is that I'm not seeing anything on my GF 630 ( on the second PC ).

 

The 740M doing things just fine,  like the HD6670.  Yet, on GF630 I'm getting a blank screen with properly cleaned color buffer and depth buffer.

 

Here's my init code:

void Window::Create() {
        // init sdl2
        if ( SDL_Init(  SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS ) ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to init SDL.");
            exit( -1 );
        }
        //  set opengl 3.3
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 );
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
        // create window
        Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
        window = SDL_CreateWindow( title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, flags );
        if ( 0 == window ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to create SDL window.");
            exit( -1 );
        }
        glContext = SDL_GL_CreateContext( window );
        // init glew
        glewExperimental = true;
        if ( GLEW_OK != glewInit() ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to init GLEW." );
            exit( -1 );
        }
        HideCursor( true );
        WarpCursorXY( width / 2, height / 2 );
    }

This one inits some default states

    void RenderingEngine::InitGLDefaults(){
        glClearColor( 0.0f, 0.0f, 0.4f, 1.0f );
        glEnable( GL_DEPTH_TEST );
        glDepthFunc( GL_LESS );
        glEnable( GL_CULL_FACE );
        glCullFace( GL_BACK );
    }

This is how I render meshes:

    void RenderingEngine::RenderMesh( const Mesh& mesh ) {
        glEnableVertexAttribArray( 0 ); // vertices
        glEnableVertexAttribArray( 1 ); // texture coords
        glEnableVertexAttribArray( 2 ); // normals

        glBindBuffer( GL_ARRAY_BUFFER, mesh.vbo );
        glVertexAttribPointer( 0, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), 0 ); // vert coords
        glVertexAttribPointer( 1, 2, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (3 * sizeof( float )) ); // tex coords
        glVertexAttribPointer( 2, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (( 3 + 2 ) * sizeof( float )) ); // normals

        glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, mesh.ibo );
        glDrawElements( GL_TRIANGLES, mesh.drawSize, GL_UNSIGNED_INT, 0 );

        glDisableVertexAttribArray( 0 );
        glDisableVertexAttribArray( 1 );
        glDisableVertexAttribArray( 2 );
    }

Here is a part of a main cycle, which involves rendering:

    void Application::Render() {
        render::RenderingEngine::RenderClear();
        testShader.Bind();

        glm::mat4 modelMatrix = testTransform.GetModelMatrix();
        glm::mat4 mvp = testCamera.GetViewProjection() * modelMatrix;

        testShader.SetUniformMat4( "MVP", mvp );
        render::RenderingEngine::RenderMesh( testMesh );
        testShader.Unbind();
        SDL_GL_SwapWindow( window.window );
    }

Again: this works on 740M and HD6670, but draws a clean screen on  GT630.

 

Halp!

Edited by syskrank

Share this post


Link to post
Share on other sites

you do not clear depth buffer in posted code. Perhaps different defaults in memory of depth buffer between ati and nvidia allows for one to pass depth test while one doesn't. Anyway, try to isolate what you can, first only do a clear on both cards, than disable all tests (alpha, depth, stencil) and so on.

Share this post


Link to post
Share on other sites

Since the glDebugMessageCallback?-stuff is rather new and probably not widely supported (I see core in 4.3 when you are using 3.3) it might be well advised to wrap all your opengl-calls with a simple macro:

void CheckOpenGLError(const char* stmt, const char* fname, int line)
{
	GLenum err = glGetError();
	if(err != GL_NO_ERROR)
	{
              // handle error here
	}
}

#ifdef _DEBUG
#define GL_CHECK(stmt) { \
	stmt; \
	CheckOpenGLError(#stmt, __FILE__, __LINE__); \
		}
#else
#define GL_CHECK(stmt) stmt
#endif

Which you can then use:

GL_CHECK(glEnableVertexAttribArray( 0 ));

and it will tell you if something is wrong in debug (compile) mode. You do need to wrap it around EVERY function that you have, or else uncaught error codes will leak to other parts of the program and cause another function to report the error instead. To end with a generic OpenGL-rant: Thats why OpenGLs global error handling and/or global state b... stuff sucks. glDebugMessageCallback is a nice step in the right direction, but for now I would recommend to use both of those side by side.

 

EDIT: Just rechecked, you might want to keep the macro around for even faster debuggin anyway, since at least on my two PCs there is no way to get the exact line of error from the glDebugMessageCallback, e.g. throwing a exception thrown is kept inside the GPU-driver dlls. With the macro you can assert, throw an exception, set a breakpoint etc.. and be fine. Repeated, use both of them side by side, as its supported in 4.2 I assume it could also work for 3.3, even though the specification tells otherwise.

Edited by Juliean

Share this post


Link to post
Share on other sites

EDIT: Just rechecked, you might want to keep the macro around for even faster debuggin anyway, since at least on my two PCs there is no way to get the exact line of error from the glDebugMessageCallback, e.g. throwing a exception thrown is kept inside the GPU-driver dlls.

glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);

Share this post


Link to post
Share on other sites

When I come across things like this I start going through all the opengl settings I can think of.

 

I find it is usually a default setting problem. (sadly not always, but it's a good place to start)

 

For example the depth buffer may be disabled by default on one machine, and enabled by default on another.

 

Textures could be disabled on one and enabled on another

 

Culling, alpha blending, draw colour, etc. can all end up giving you a blank screen. You are setting a couple of them, but I don't see you bind a texture, I don't see you enabling texture 2D.

 

I see you passing in texture coords though.

 

After that you have to look at your shader, do the obvious things (check it's compiling, check it's linking, check the drivers are up to date,....)

Share this post


Link to post
Share on other sites

Wow, thanks a lot for the replies :) Didn't expect that at all after silent sdl2 forums :)

 

 

you do not clear depth buffer in posted code. Perhaps different defaults in memory of depth buffer between ati and nvidia allows for one to pass depth test while one doesn't. Anyway, try to isolate what you can, first only do a clear on both cards, than disable all tests (alpha, depth, stencil) and so on.

I do, I swear :) Rechecked everything, I am calling to glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) before every frame. So that's ok.

Also, I'm getting sane rendering results on both nvidia and amd cards, there is an another nvidia card, that causing problems ( as I said before ).

 

Like this:

GF740M - OK

HD6770 - OK

GF630 - ERROR

 

 


Which you can then use:

GL_CHECK(glEnableVertexAttribArray( 0 ));

 

Well, thanks a lot for debugging method suggestion. I've implemented this and integrated it with my logging system.

 

My rendering method now looks like:

    // TODO: fix rendering on GF630
    void RenderingEngine::RenderMesh( const Mesh& mesh ) {
        GL_CHECK(glEnableVertexAttribArray( 0 )); // vertices
        GL_CHECK(glEnableVertexAttribArray( 1 )); // texture coords
        GL_CHECK(glEnableVertexAttribArray( 2 )); // normals

        GL_CHECK(glBindBuffer( GL_ARRAY_BUFFER, mesh.vbo ));
        GL_CHECK(glVertexAttribPointer( 0, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), 0 )); // vert coords
        GL_CHECK(glVertexAttribPointer( 1, 2, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (3 * sizeof( float )) )); // tex coords
        GL_CHECK(glVertexAttribPointer( 2, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (( 3 + 2 ) * sizeof( float )) )); // normals

        glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, mesh.ibo );
        glDrawElements( GL_TRIANGLES, mesh.drawSize, GL_UNSIGNED_INT, 0 );

        glDisableVertexAttribArray( 0 );
        glDisableVertexAttribArray( 1 );
        glDisableVertexAttribArray( 2 );
    }

Also, I've changed the profile to OpenGL core 4.3.

And now I'm getting these messages ( same on 3.3 ):

Message: (1396343898768): Running with OpenGL 4.3.0 NVIDIA 319.32
Error: (1396343898768): OpenGL error in 'glEnableVertexAttribArray( 0 )'-'/home/user/projects/my3d/src/render/RenderingEngine.cpp': 13: invalid enumerant
Error: (1396343898768): OpenGL error in 'glVertexAttribPointer( 0, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), 0 )'-'/home/user/projects/my3d/src/render/RenderingEngine.cpp': 18: invalid operation
Error: (1396343898768): OpenGL error in 'glVertexAttribPointer( 1, 2, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (3 * sizeof( float )) )'-'/home/user/projects/my3d/src/render/RenderingEngine.cpp': 19: invalid operation
Error: (1396343898768): OpenGL error in 'glVertexAttribPointer( 2, 3, GL_FLOAT, false, VERTEX_COMPONENTS * sizeof( float ), (char*) (( 3 + 2 ) * sizeof( float )) )'-'/home/user/projects/my3d/src/render/RenderingEngine.cpp': 20: invalid operation

Looks like it's something with the opengl settings, yeah. But I've failed to guess what exactly.

Share this post


Link to post
Share on other sites

OK, I figured that out.

That was completely my fault with SDL2 context initialization.

For some reason, GF740M and HD6670 were indifferent to SDL_GL_SetAttribute() call order, but on GF630 that spoiled everything.

 

The error was at the point where I created a window:

void Window::Create() {
        // init sdl2
        if ( SDL_Init(  SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS ) ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to init SDL.");
            exit( -1 );
        }
        //  set opengl 3.3
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 );
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
        // create window
        Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
        window = SDL_CreateWindow( title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, flags );
        if ( 0 == window ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to create SDL window.");
            exit( -1 );
        }
        glContext = SDL_GL_CreateContext( window );
        // init glew
        glewExperimental = true;
        if ( GLEW_OK != glewInit() ) {
            Logger::WriteLog( LOG_S_ERROR, "Unable to init GLEW." );
            exit( -1 );
        }
        HideCursor( true );
        WarpCursorXY( width / 2, height / 2 );
    }

Notice that bunch of SDL_GL_* calls ?

They must be placed !!!AFTER!!! SDL_GL_CreateContext(). i.e.

void Window::Create() {
        // init sdl2
        if ( SDL_Init(  SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS ) ) {
                Logger::WriteLog( LOG_S_ERROR, "Unable to init SDL.");
                exit( -1 );
            }
        // create window
        Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
        window = SDL_CreateWindow( title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, flags );
        if ( 0 == window ) {
                Logger::WriteLog( LOG_S_ERROR, "Unable to create SDL window.");
                exit( -1 );
            }
        glContext = SDL_GL_CreateContext( window );
        // init glew
        glewExperimental = true;
        if ( GLEW_OK != glewInit() ) {
                Logger::WriteLog( LOG_S_ERROR, "Unable to init GLEW." );
                exit( -1 );
            }
        // set gl attribs
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 4 );
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 );
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
        SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
        // set vsync
        SDL_GL_SetSwapInterval( 1 );
        // manage cursor
        HideCursor( true );
        WarpCursorXY( width / 2, height / 2 );
    }

I changed it, and everything started to work ( rechecked on GF740 - still good results ). Hey, bunny! :)

 

5089545.png

 

Thanks a lot to everyone.

 

Hope this will help somebody in future.

Share this post


Link to post
Share on other sites

I believe now you are initializing the OpenGL context with SDL's default values, whatever they are (ie. your SDL_GL_SetAttribute() calls have no effect)

Share this post


Link to post
Share on other sites

AgentC is correct, those SDL_GL_SetAttribute calls do nothing at all if placed after context creation.

Edited by Mona2000

Share this post


Link to post
Share on other sites

Wow, that's strange, didn't read docs enough. If I couldn't find the faulty one, then it will be better to completely remove them.

Share this post


Link to post
Share on other sites

I just want to point out that glGetError actually causes significant performance overhead, because it triggers pipeline flushes. In my case I found it advantageous to set a separate define to call it after every GL call and only enable that functionality periodically as a check or when something went wrong.

Share this post


Link to post
Share on other sites

Hello again, everyone.

 


I believe now you are initializing the OpenGL context with SDL's default values, whatever they are (ie. your SDL_GL_SetAttribute() calls have no effect)

 

Well, it seems to be like this.

But what are these defaults?

 

I've placed

SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 4 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 );

before window creation again, and that's causing errors to appear.

 

When I remove these lines, all works OK, logger reports that system is started with OpenGL 4.3 on nvidia driver v 319.32.

 

My card supports OpenGL 4.3, thats for sure. Driver supports that card, so the issue is within SDL 2 then ?

Share this post


Link to post
Share on other sites

Yes, I tried. And, unfortunately, I've ended up with the same issues.  On GF630 every GL version request fails with 'invalid enumerant'/'invalid operation'.

Without version request it initializes GL 4.3 ( as max of what this GPU is capable of ) and everything seems to be fine.

 

Maybe it's something like this exact driver working weird with  this exact model of GPU card ?

I have the same driver on the laptop with GF740 and it's all ok there with SDL_GL_SetAttribute( SDL_GL_CONTEXT* ) calls.

 

Will try another driver on the next week and post here the results.

Share this post


Link to post
Share on other sites

Well, I've tried to specify the OpenGL version on GF630 with the new driver [ sorry, took more than a week to get to this point ] :

Message: (1397464013393): Running with OpenGL 4.4.0 NVIDIA 331.67

... and now I'm getting the same strange error strings just like before. I don't know now whom to fight:

 

Linux OS ( 2/3 PCs works great ),

SDL2 ( weird things on the inside ??? )

or my own code ( seems more obvious, but I'm doing the standard init routine, and again - it works out on 2 of 3 PCs ),

or even the nVIDIA card/drivers  ???

 

Maybe I can go in some hardcore way with some #ifdefs and platform-dependent code, using WinAPI for Win32 and X11 window init for *nix systems. That should cut off the SDL2 part away.

But is it worth it ?

Share this post


Link to post
Share on other sites

Which version of the GF630 do you have? Only the Kepler version supports GL 4.3, the others only support up to 4.2 (according to NVIDIA specs). I don't think much will come from specifying it with the new driver as I'm thinking it's a hardware limitation. So with that, I'd say try switching it to 4.0-4.2 instead of 4.3 and see if it works then.

 

 

If you suspect SDL, then you can try switching to GLFW and see if the problem persists. :)

Share this post


Link to post
Share on other sites

It's seems that hardware is OK - by default the 4.4 profile is initialized ( it is when version demands are commented-out from the code ) - my app gets these numbers from the OpenGL version string.

 

And I was trying to get a 3.3 core in the first part.

 

Well, the migration to the GLFW is still possible, but I feel the input system there a bit tricky + it seems that GLFW is limiting itself to a 60 FPS.

I'll give it another try in order to find the guilty one :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Similar Content

    • By khawk
      We've just released all of the source code for the NeHe OpenGL lessons on our Github page at https://github.com/gamedev-net/nehe-opengl. code - 43 total platforms, configurations, and languages are included.
      Now operated by GameDev.net, NeHe is located at http://nehe.gamedev.net where it has been a valuable resource for developers wanting to learn OpenGL and graphics programming.

      View full story
    • By TheChubu
      The Khronos™ Group, an open consortium of leading hardware and software companies, announces from the SIGGRAPH 2017 Conference the immediate public availability of the OpenGL® 4.6 specification. OpenGL 4.6 integrates the functionality of numerous ARB and EXT extensions created by Khronos members AMD, Intel, and NVIDIA into core, including the capability to ingest SPIR-V™ shaders.
      SPIR-V is a Khronos-defined standard intermediate language for parallel compute and graphics, which enables content creators to simplify their shader authoring and management pipelines while providing significant source shading language flexibility. OpenGL 4.6 adds support for ingesting SPIR-V shaders to the core specification, guaranteeing that SPIR-V shaders will be widely supported by OpenGL implementations.
      OpenGL 4.6 adds the functionality of these ARB extensions to OpenGL’s core specification:
      GL_ARB_gl_spirv and GL_ARB_spirv_extensions to standardize SPIR-V support for OpenGL GL_ARB_indirect_parameters and GL_ARB_shader_draw_parameters for reducing the CPU overhead associated with rendering batches of geometry GL_ARB_pipeline_statistics_query and GL_ARB_transform_feedback_overflow_querystandardize OpenGL support for features available in Direct3D GL_ARB_texture_filter_anisotropic (based on GL_EXT_texture_filter_anisotropic) brings previously IP encumbered functionality into OpenGL to improve the visual quality of textured scenes GL_ARB_polygon_offset_clamp (based on GL_EXT_polygon_offset_clamp) suppresses a common visual artifact known as a “light leak” associated with rendering shadows GL_ARB_shader_atomic_counter_ops and GL_ARB_shader_group_vote add shader intrinsics supported by all desktop vendors to improve functionality and performance GL_KHR_no_error reduces driver overhead by allowing the application to indicate that it expects error-free operation so errors need not be generated In addition to the above features being added to OpenGL 4.6, the following are being released as extensions:
      GL_KHR_parallel_shader_compile allows applications to launch multiple shader compile threads to improve shader compile throughput WGL_ARB_create_context_no_error and GXL_ARB_create_context_no_error allow no error contexts to be created with WGL or GLX that support the GL_KHR_no_error extension “I’m proud to announce OpenGL 4.6 as the most feature-rich version of OpenGL yet. We've brought together the most popular, widely-supported extensions into a new core specification to give OpenGL developers and end users an improved baseline feature set. This includes resolving previous intellectual property roadblocks to bringing anisotropic texture filtering and polygon offset clamping into the core specification to enable widespread implementation and usage,” said Piers Daniell, chair of the OpenGL Working Group at Khronos. “The OpenGL working group will continue to respond to market needs and work with GPU vendors to ensure OpenGL remains a viable and evolving graphics API for all its customers and users across many vital industries.“
      The OpenGL 4.6 specification can be found at https://khronos.org/registry/OpenGL/index_gl.php. The GLSL to SPIR-V compiler glslang has been updated with GLSL 4.60 support, and can be found at https://github.com/KhronosGroup/glslang.
      Sophisticated graphics applications will also benefit from a set of newly released extensions for both OpenGL and OpenGL ES to enable interoperability with Vulkan and Direct3D. These extensions are named:
      GL_EXT_memory_object GL_EXT_memory_object_fd GL_EXT_memory_object_win32 GL_EXT_semaphore GL_EXT_semaphore_fd GL_EXT_semaphore_win32 GL_EXT_win32_keyed_mutex They can be found at: https://khronos.org/registry/OpenGL/index_gl.php
      Industry Support for OpenGL 4.6
      “With OpenGL 4.6 our customers have an improved set of core features available on our full range of OpenGL 4.x capable GPUs. These features provide improved rendering quality, performance and functionality. As the graphics industry’s most popular API, we fully support OpenGL and will continue to work closely with the Khronos Group on the development of new OpenGL specifications and extensions for our customers. NVIDIA has released beta OpenGL 4.6 drivers today at https://developer.nvidia.com/opengl-driver so developers can use these new features right away,” said Bob Pette, vice president, Professional Graphics at NVIDIA.
      "OpenGL 4.6 will be the first OpenGL release where conformant open source implementations based on the Mesa project will be deliverable in a reasonable timeframe after release. The open sourcing of the OpenGL conformance test suite and ongoing work between Khronos and X.org will also allow for non-vendor led open source implementations to achieve conformance in the near future," said David Airlie, senior principal engineer at Red Hat, and developer on Mesa/X.org projects.

      View full story
    • By _OskaR
      Hi,
      I have an OpenGL application but without possibility to wite own shaders.
      I need to perform small VS modification - is possible to do it in an alternative way? Do we have apps or driver modifictions which will catch the shader sent to GPU and override it?
    • By xhcao
      Does sync be needed to read texture content after access texture image in compute shader?
      My simple code is as below,
      glUseProgram(program.get());
      glBindImageTexture(0, texture[0], 0, GL_FALSE, 3, GL_READ_ONLY, GL_R32UI);
      glBindImageTexture(1, texture[1], 0, GL_FALSE, 4, GL_WRITE_ONLY, GL_R32UI);
      glDispatchCompute(1, 1, 1);
      // Does sync be needed here?
      glUseProgram(0);
      glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
      glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                     GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture[1], 0);
      glReadPixels(0, 0, kWidth, kHeight, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues);
       
      Compute shader is very simple, imageLoad content from texture[0], and imageStore content to texture[1]. Does need to sync after dispatchCompute?
    • By Jonathan2006
      My question: is it possible to transform multiple angular velocities so that they can be reinserted as one? My research is below:
      // This works quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); quat quaternion2 = GEMultiplyQuaternions(quaternion1, GEQuaternionFromAngleRadians(angleRadiansVector2)); quat quaternion3 = GEMultiplyQuaternions(quaternion2, GEQuaternionFromAngleRadians(angleRadiansVector3)); glMultMatrixf(GEMat4FromQuaternion(quaternion3).array); // The first two work fine but not the third. Why? quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); vec3 vector1 = GETransformQuaternionAndVector(quaternion1, angularVelocity1); quat quaternion2 = GEQuaternionFromAngleRadians(angleRadiansVector2); vec3 vector2 = GETransformQuaternionAndVector(quaternion2, angularVelocity2); // This doesn't work //quat quaternion3 = GEQuaternionFromAngleRadians(angleRadiansVector3); //vec3 vector3 = GETransformQuaternionAndVector(quaternion3, angularVelocity3); vec3 angleVelocity = GEAddVectors(vector1, vector2); // Does not work: vec3 angleVelocity = GEAddVectors(vector1, GEAddVectors(vector2, vector3)); static vec3 angleRadiansVector; vec3 angularAcceleration = GESetVector(0.0, 0.0, 0.0); // Sending it through one angular velocity later in my motion engine angleVelocity = GEAddVectors(angleVelocity, GEMultiplyVectorAndScalar(angularAcceleration, timeStep)); angleRadiansVector = GEAddVectors(angleRadiansVector, GEMultiplyVectorAndScalar(angleVelocity, timeStep)); glMultMatrixf(GEMat4FromEulerAngle(angleRadiansVector).array); Also how do I combine multiple angularAcceleration variables? Is there an easier way to transform the angular values?
  • Popular Now