在GLM中加载纹理(Loading a texture in GLM)

编程入门 行业动态 更新时间:2024-10-27 12:24:54
在GLM中加载纹理(Loading a texture in GLM)

嘿我使用GLM(由nate robins制作)与SFML和opengl在mingw32上使用IDE作为CodeBlocks(windows)

使用GLM加载我的纹理时: http : //www.3dcodingtutorial.com/Working-with-3D-models/Getting-GLM.html

嘿我设法通过更改我的代码以更好地加载纹理摆脱颜色问题,但现在我无法得到纹理显示...

以下是我主要的新链接: http : //pastebin.com/gasu1Hux

我一直在查找GLm教程,但我找不到任何关于我的纹理没有显示的正确答案.....

也许我错过了什么?

/////////////////////旧//////////////////////////// /

我也尝试了devernay.free.fr中的那个,但我总是得到一个纹理错误(不会发布,因为每次我这样做,我的问题被击落......)

我有一个小故障,我的整个模型是蓝色而不是默认的灰色......

我发现我没有自己加载纹理的GLM库..

所以我设法从3dcodingtutorial.com找到一个纹理加载器

当我加载未放在模型上的纹理时,它只是改变它的颜色。

现在我想知道为什么我的模型是单一颜色而不是我设置的纹理。

继承了我用于制作纹理和绘制模型的一些代码:

好的继承main.cpp

抱歉错误粘贴._。

粘贴已更新!!

http://pastebin.com/tcwwasb9

hey im using GLM(made by nate robins) with SFML and opengl on mingw32 with the IDE as CodeBlocks(windows)

when loading my texture with the GLM from: http://www.3dcodingtutorial.com/Working-with-3D-models/Getting-GLM.html

hey i managed to get rid of the color problem by changing up my code to better load the textures, but now im not able to get the texture to display...

heres the NEW link to my main: http://pastebin.com/gasu1Hux

i have been looking up GLm tutorials but i cant find any correct answers about my texture not displaying at all.....

maybe im missing something?

/////////////////////OLD/////////////////////////////

also i tried the one from devernay.free.fr, but i always get a texture error (not gonna post because everytime i do, my question gets downed...)

i had gotten a small glitch where my whole model is blue instead of the default gray...

i found out that the GLM library i have doesnt load textures by itself..

so i managed to find a texture loader from 3dcodingtutorial.com

when i load the texture its not put on the model, it just changes its color.

right now im wondering why my model is one single color instead of the texture i setup.

heres some of the code that i used to make the texture and draw the model:

ok heres the main.cpp

sorry wrong paste ._.

the paste has been updated!!

http://pastebin.com/tcwwasb9

最满意答案

默认的GL_TEXTURE_ENV_MODE是GL_MODULATE 。 确保你不是无意中在某处设置了颜色状态,或者在使用纹理渲染某些内容之前强制使用glColor3ub(255,255,255)解决问题。

编辑: GL_DECAL也是一个选项。

The default GL_TEXTURE_ENV_MODE is GL_MODULATE. Make sure you aren't inadvertently setting your color state somewhere, or force the issue with glColor3ub(255,255,255) before you render something with a texture.

EDIT: GL_DECAL is also an option.

更多推荐

本文发布于:2023-07-22 14:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1220595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:纹理   加载   GLM   Loading   texture

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!