Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Dieser Beitrag wurde bereits 6 mal editiert, zuletzt von »dot« (23.02.2012, 13:01)
Ich habe das aus Interesse gerade mal ausprobiert indem ich in meiner Render-Loop in einer For-Schleife via BIND eine Texture und drei Buffer swappe. Einen Einfluß auf meine Framerate hat das erst wenn die For-Schleife 20000 durchlaufen wird (also 20000 Texture- und 60000 Buffer-Swaps pro Render pass). So ein performancekiller kann das also nicht sein.Zitat
Durch das merkwürdige Objektmodell (der ganze Bind Kram), ist das entweder nur sehr ineffizient möglich ...
Zitat
Beachte auch den Kontext aus dem du das Zitat genommen hast...
Zitat
Beachte auch den Kontext aus dem du das Zitat genommen hast...
Vieleicht habe ich ja was falsch verstanden, aber ziehlte der Teil deines Posts (und der NV-Link) nicht darauf ab dass das Bind-Use Model von OpenGL ineffizient (langsam) ist ?
Zitat von »NVIDIA«
Measurements have shown that bindless graphics can result in more than 7x speedup!
Dieser Beitrag wurde bereits 8 mal editiert, zuletzt von »dot« (23.02.2012, 23:43)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
// main message loop QueryPerformanceFrequency((LARGE_INTEGER*)(&llFrequency)); while (1) { QueryPerformanceCounter((LARGE_INTEGER*)(&llTime1)); // check for messages if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { // handle or dispatch messages if ( msg.message == WM_QUIT ) break; else { TranslateMessage( &msg ); DispatchMessage( &msg ); } } // Clear buffer (color and depth) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // move camera if(bForward == true) Camera.Forward(150.0f * g_fTimeDiff); // pasing uniform to shader CVector3 vLightPos(0.0f, 200.0f, 0.0f); CMatrix44 MVM1, MVM2, NM1, NM2; GLint nLocation; float m3[9]; CVector3 vTemp(0.0f, 0.0f, 0.0f); CMatrix44 mTemp; // set light pos vTemp = Camera.GetCameraMatrix() * (/*CMatrix44::Build_RotationMatrix(g_fTimeElapsed, 0.0f, 0.0f) * */vLightPos); nLocation = GL::glGetUniformLocation(nShaderProg, "zLightPos"); GL::glUniform3f(nLocation, vTemp.x, vTemp.y, vTemp.z); // set mv matrix 1 MVM1 = Camera.GetCameraMatrix() * CMatrix44::Build_RotationMatrix(0.0f, 0.0f, (PI/ 4.0f) * sinf(g_fTimeElapsed / 0.1f)); nLocation = GL::glGetUniformLocation(nShaderProg, "zMVM1"); GL::glUniformMatrix4fv(nLocation, 1, false, MVM1.m); // set normal matrixn 1 mTemp = MVM1.Invert(); mTemp = mTemp.Transpose(); mTemp.ConvertToMat3(m3); nLocation = GL::glGetUniformLocation(nShaderProg, "zNM1"); GL::glUniformMatrix3fv(nLocation, 1, false, m3); // set mv matrix 2 MVM2 = Camera.GetCameraMatrix() * CMatrix44::Build_RotationMatrix(0.0f, 0.0f, (PI/-2.0f) * sinf(g_fTimeElapsed / 2.0f)); nLocation = GL::glGetUniformLocation(nShaderProg, "zMVM2"); GL::glUniformMatrix4fv(nLocation, 1, false, MVM2.m); // set normal matrixn 2 mTemp = MVM2.Invert(); mTemp = mTemp.Transpose(); mTemp.ConvertToMat3(m3);nLocation = GL::glGetUniformLocation(nShaderProg, "zNM2");GL::glUniformMatrix3fv(nLocation, 1, false, m3); for(int x=0; x<20000; x++) { //::Sleep(0); Plane.Bind(); Torus.Bind(); } // draw Plane.Bind(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); Plane.Draw(); Torus.Bind(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); Torus.Draw(); // Swap back-buffer to front SwapBuffers( GL::m_hDC ); // Calculate frametime QueryPerformanceCounter((LARGE_INTEGER*)(&llTime2));g_fTimeDiff = ((float)llTime2 - (float)llTime1) / (float)llFrequency; g_fTimeElapsed += g_fTimeDiff; } |
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »dot« (24.02.2012, 00:15)
Werbeanzeige