Jump to content

LE crashes when glTexImage2d() is called


deniz
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

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

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

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.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...