opengl

Load a PNG file with pure OpenGL

孤街浪徒 提交于 2021-01-28 11:53:22
问题 I am trying to make a simple game in Java. I want to know how I can read a PNG file and use it in the game using only the OpenGL library. Can anyone provide any code that could accomplish this? 回答1: You can't load a texture directly using a single API call. You can however load a BufferedImage through ImageIO, and then convert it to an OpenGL texture. Example source code can be found here TextureLoader 回答2: You can't load images only using OpenGL. You should always keep in mind that OpenGL is

What is wrong with my installation of glfw3?

て烟熏妆下的殇ゞ 提交于 2021-01-28 10:14:13
问题 I tried to build glfw but something seems wrong with my installation with cmake under windows. I tried to do the following steps to build the glfw-library with cmake: git clone https://github.com/glfw/glfw cd glfw mkdir build-MinGW32 cd build-MinGW32 I then produced the build system "MinGW Makefiles" with cmake giving it the source directory (not the src folder) of the glfw repository: $ cmake -G "MinGW Makefiles" ../ Result of former: -- The C compiler identification is GNU 6.3.0 -- Check

I have a black texture

冷暖自知 提交于 2021-01-28 09:09:51
问题 This is my first time working with textures in OpenGL, although I've been studying it for 4 months now. And when I try to load a texture (Just an image with a square) I get just a black square.\ My texture load code: byte[] pixelData = new byte[0]; try { BufferedImage bi = ImageIO.read(getClass().getResource(TEXTURE_FILES)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bi, "png", baos); baos.flush(); pixelData = baos.toByteArray(); baos.close(); } catch (IOException

Why can't Pyglet draw a polygon correctly?

六眼飞鱼酱① 提交于 2021-01-28 07:30:44
问题 I'm randomly creating points to use to draw a polygon with Pyglet. But Pyglet doesn't do the job right most of the time. Well I tried drawing a polygon with another graphic module and actually it worked but if Pyglet was working alright it would make my job easier. I use this to draw polygon and points (to make it easy for you see). point_list = [18, 61, 59, 149, 328, 204, 305, 284, 3, 197, 25, 107] ec = int(len(point_list)/2) batch.add(ec, pyglet.gl.GL_POLYGON, None, ("v2i", point_list), (

Undefined references to OpenGL on Ubuntu

青春壹個敷衍的年華 提交于 2021-01-28 06:48:00
问题 I'm getting all these undefined references: Linking CXX executable SimpleGavam ../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam::DrawMesh(cv::Mat_<float>&, cv::Mat_<float> const&, cv::Mat_<int> const&, cv::Vec<double, 6> const&, double, double, double, double, cv::Size_<int> const&, double, double)': /home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:189: undefined reference to `glutSwapBuffers' ../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam:

Issues with animation - translation, projection OpenGL/C++

混江龙づ霸主 提交于 2021-01-28 05:34:18
问题 Recently I had this issue. Now that I've fixed that with given solution, I ran into some other issues. Here is a gif of the animation I have to achieve. Issues I have now are: the ball in my animation doesn't look like it's moving forwards and backwards like it is at the beginning of the .gif. I do believe this has something to do with Ortho but I don't know how to fix this. Also, at some point, when it's moving completely to the right, the moving ball and torus just get "swallowed", it's

Embedding manifest into the application binary breaks OpenGL 2

三世轮回 提交于 2021-01-28 03:29:33
问题 My application uses OpenGL. Everything worked until today, when I embedded the following manifest into the .exe. I need it for the sole purpose of being able to get the current OS version with the isWindowsNOrGreater functions, which are capped at Windows 8 (not even 8.1) unless the application has explicitly specified support for Windows 8.1 and/or 10: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3=

Is there a way to change the location and size of an imported .obj file in Pygame?

北慕城南 提交于 2021-01-28 03:25:54
问题 I created an .obj file using blender and loaded into Pygame using the OBJfileloader as sugested by skrx in: Error in OBJFileLoader Is there an easy way to change the location, height and width of the imported .obj file after importing it into Pygame? As an example, if you create a tree.obj file, to be able to place that same tree in different places with different sizes? Following the code below, maybe something like: object_obj = OBJ("Tree.obj", swapyz=False) object_obj.setX = 0 object_obj

Embedding manifest into the application binary breaks OpenGL 2

杀马特。学长 韩版系。学妹 提交于 2021-01-28 02:20:49
问题 My application uses OpenGL. Everything worked until today, when I embedded the following manifest into the .exe. I need it for the sole purpose of being able to get the current OS version with the isWindowsNOrGreater functions, which are capped at Windows 8 (not even 8.1) unless the application has explicitly specified support for Windows 8.1 and/or 10: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3=

Read from one texture and write to a separate texture with in the same frame buffer

瘦欲@ 提交于 2021-01-28 02:04:15
问题 I have a Framebuffer with 2 textures attached is it possible to read from texture A and write to texture B, in the same fragment shader function ? Thanks. 回答1: This is trickier than I expected. I thought that as long as you don't sample from and render to the same texture you would be fine, no matter if the texture is attached to an FBO. But while trying to find some conclusive spec quotes to back this up, things became much less clear. The 4.5 spec does contain a phrase that seems to confirm