Jump to content

OpenGL Texturing


MasteR
 Share

Recommended Posts

Does anyone have experience in manually loading images and using the surface data as an OpenGL texture?

 

I'm writing a DDS loader:

 

In particular I need to use to OpenGL command glCompressedTexImage2D, I receive a linker error when trying to use it. The problem is I have no idea where the function definition is and therefore no idea which lib, dll, header, etc to include.

 

Any thoughts?

 

Anyone written their own DDS image loader (or other formats) before, if so I'd very much like to pick your brains and receive some mentoring.

AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz)

4 GB DDR2 RAM

2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB)

Windows XP Pro

Link to comment
Share on other sites

You need to include the glew library:

http://glew.sourceforge.net/

 

I would use the image loader from SDL, since I need SDL in any game anyway (joystick support, network support).

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

I wanted to avoid using 3rd party libraries, but that’s exactly what glew seems to be

 

I may as well use OpenIL if that’s the case

 

 

*EDIT*

 

Let’s keep this ball rolling.

 

My issue is not the loading of the DDS file as that was simple enough.

 

However assistance is needed in using this collected data to create an OpenGL texture.

 

Anyone created their own OpenGL image and texture loader...care to assist?

AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz)

4 GB DDR2 RAM

2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB)

Windows XP Pro

Link to comment
Share on other sites

glew basically helps to make ARB and EXT gl_extensions available iirc.

However, you could take a look into the "glext.h" for which extension the "CompressedTexImage2D" command would ask for and implement the extension yourself. There are plenty of tutorials how one would implement FrameBufferObjects etc. - its all the same "basically". :blink:

 

imho 3rd party libs are great if not to huge or simply redundant i.e. horrible to write a own openGL renderer w/o such thinks like glew i assume.

 

[edit]

 

glCompressedTexImage2D (OpenGL 1.3, ARB_texture_compression)

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
Share on other sites

After a look through glew.h I was able to define the function using:

PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;

Seem right?

 

The program compiles and runs, but no texture shows, this could be caused by:

 

Incorrectly reading the surface pixel data

Incorrectly creating an OpenGL texture

Incorrectly texture mapping a quad

 

anyone done this before ( manually reading an image file and creating an OpenGL texture), willing to look over my code and get it sorted out. I'm very much new to OpenGL.

AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz)

4 GB DDR2 RAM

2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB)

Windows XP Pro

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...