Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » OpenGL texture issues
OpenGL texture issues [message #40710] Sun, 08 September 2013 07:30 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am attempting to implement SDraw based OpenGL Draw. I am total OpenGL newbie, so I have some perhpas stupid questions. Mostly I am getting my inspiration from rainbow/GL* packages by unodgs and there are issues that I need to clear out:

- it looks to like OpenGL expects textures in non-premultiplies format. In that case we need to unmultiply Image, right? (I have not seen any such thing in CoreGL/resources.cpp, but I might be missing something).

- Somewhere (but not in OpenGL docs) I have read that texture size should be a power of 2. Is that still true? (Again, no proof of this in CoreGL...)

Mirek
Re: OpenGL texture issues [message #40711 is a reply to message #40710] Sun, 08 September 2013 07:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mirek wrote on Sun, 08 September 2013 01:30


- it looks to like OpenGL expects textures in non-premultiplies format. In that case we need to unmultiply Image, right? (I have not seen any such thing in CoreGL/resources.cpp, but I might be missing something).



Ha, 2 minutes after posting, I have found in CoreGL

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


which, AFAIK, should exactly switch OpenGL to premultiplied alpha mode, right? Smile

Mirek
Re: OpenGL texture issues [message #40716 is a reply to message #40711] Sun, 08 September 2013 12:26 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

mirek wrote on Sun, 08 September 2013 01:35

mirek wrote on Sun, 08 September 2013 01:30


- it looks to like OpenGL expects textures in non-premultiplies format. In that case we need to unmultiply Image, right? (I have not seen any such thing in CoreGL/resources.cpp, but I might be missing something).



Ha, 2 minutes after posting, I have found in CoreGL

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);



I have to admit I didn't even think about it Smile But docs says it is exactly prempultiplied mode.

If it comes to textures of power of 2 it is true for opengl es - so for all mobile devices. On desktop it is not required.

[Updated on: Sun, 08 September 2013 12:26]

Report message to a moderator

Re: OpenGL texture issues [message #40719 is a reply to message #40716] Sun, 08 September 2013 19:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
unodgs wrote on Sun, 08 September 2013 06:26

mirek wrote on Sun, 08 September 2013 01:35

mirek wrote on Sun, 08 September 2013 01:30


- it looks to like OpenGL expects textures in non-premultiplies format. In that case we need to unmultiply Image, right? (I have not seen any such thing in CoreGL/resources.cpp, but I might be missing something).



Ha, 2 minutes after posting, I have found in CoreGL

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);



I have to admit I didn't even think about it Smile But docs says it is exactly prempultiplied mode.

If it comes to textures of power of 2 it is true for opengl es - so for all mobile devices. On desktop it is not required.


Actually, OpenGL ES 2.0 says that non-power-of-2 textures are OK as well, just do not support mipmapping...

Mirek
Re: OpenGL texture issues [message #41176 is a reply to message #40719] Fri, 08 November 2013 15:06 Go to previous message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
Hello,

In opengl/openglES(2.0+) there is almost no limitation on the dimension of the texures, only the maximum size and most mobile GPU's support 4096x4096 maximum size (desktops even more).

The power of 2 texture size is a limitation imposed by textures compossion, so if you want to have compressed textures you need power of 2 otherwise compression will not be possible.

PVRTC compression also requires for the textures to be square.

Other features such as mip mapping and swizzled textures will still not be possible without power of 2 textures.

Razvan.


92b48bf94855483bb4cec8bcc8c0c933

[Updated on: Fri, 08 November 2013 15:07]

Report message to a moderator

Previous Topic: [Tutorial] Using the Visual Studio IDE with U++
Next Topic: Serialization technique
Goto Forum:
  


Current Time: Fri Apr 19 23:09:42 CEST 2024

Total time taken to generate the page: 0.03944 seconds