deniz Posted June 2, 2011 Share Posted June 2, 2011 Hi everyone, I try to use glTexImage2d() to upload a texture I generate during run-time but when I call glTexImage2d(), LE strangely crashes.. crashes also occur when I call glreadPixels(). any suggestions? Quote Link to comment Share on other sites More sharing options...
Canardia Posted June 2, 2011 Share Posted June 2, 2011 You need to use LE's BindTexture() command, before you can use those commands. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
deniz Posted June 2, 2011 Author Share Posted June 2, 2011 You need to use LE's BindTexture() command, before you can use those commands. I used it and even checked parameters of the texture (size, format etc) with glGetTexLevelParameteriv(), all is correct.. essentially this happens after entering the rendering loop, before entering the loop everything works fine.. and even after entering the loop all goes well for some short amount of time but after a while something happens (LE loads guide.vert or something like that) and just after that LE crashes. Quote Link to comment Share on other sites More sharing options...
Canardia Posted June 2, 2011 Share Posted June 2, 2011 Maybe you need to make LE preload the shaders, so don't use your OpenGL commands befora you have called RenderFramework() before the main loop once. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
deniz Posted June 2, 2011 Author Share Posted June 2, 2011 Maybe you need to make LE preload the shaders, so don't use your OpenGL commands befora you have called RenderFramework() before the main loop once. I see, thanks.. how can I do that? and even if I do that preloading, is it guaranteed that same crash won't happen again? I mean, something clearly changes the opengl states, it seems that they need to be restored.. it would be very nice if I knew which ones. Quote Link to comment Share on other sites More sharing options...
Canardia Posted June 2, 2011 Share Posted June 2, 2011 RenderFramework doesn't initialize everything in the first call, but sometimes it takes a few calls to get everything loaded. For example the 32 water textures can take up to 32 seconds to load. But when you call RenderFramework for a few seconds before the main loop and rotate and move the camera around, everything what is critical should be loaded. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Josh Posted June 2, 2011 Share Posted June 2, 2011 Always set these values right before you do anything with OpenGL images and pixels: glPixelStorei GL_PACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format] glPixelStorei GL_PACK_ALIGNMENT,1 glPixelStorei GL_UNPACK_ALIGNMENT,1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted June 2, 2011 Share Posted June 2, 2011 Josh with the right solution! I was going to say the same thing as I ran into this issue when rendering CEGUI with Leadwerks. Always remember the glPixelStorei calls. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
deniz Posted June 3, 2011 Author Share Posted June 3, 2011 Always set these values right before you do anything with OpenGL images and pixels: glPixelStorei GL_PACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format] glPixelStorei GL_PACK_ALIGNMENT,1 glPixelStorei GL_UNPACK_ALIGNMENT,1 all worked well.. thanks Josh! I was calling glPixelStorei(GL_PACK_ALIGNMENT,1) but skipped the other parameters like GL_PACK_ROW_LENGTH. thank you all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.