FAQ Database Discussion Community


drawing a structure using x,y,z coordinates in php

php,opengl
I want to create a chemical structures using below x,y,z values. Those structures are needed to call from a PHP interface. At-no indicates atomic number of molecules included in it. eg : 6 indicates carbon, 7 indicates Nitrogen, 1 indicates Hydrogen. So based on coordinates values of C,N,H need to...

Is it possible to build a heatmap from point data at 60 times per second?

c++,opengl,visualization,simulation,heatmap
I'm working on a simulation for clouds (actual clouds) where the clouds are simulated by 3D points, then projected into a 2D heatmap, about 640x480 units big. The number of points is about 50k, which is as small as I can go without the simulation breaking, but I can't seem...

Spotlight with shadows becomes square-like

c++,opengl,graphics,shader,shadow
I've been following a two part tutorial on shadow mapping from OGLDev (part 1, part 2) for a couple of days now, and I've nearly finished implementing it. My problem is that when I enable shadow maps the illuminated region which shadows appear in appears as a "strip" and I'm...

OpenGL: GL_FRAMEBUFFER_UNSUPPORTED on specific combinations of framebuffer attachments

c++,opengl,textures,nvidia,framebuffer
Im trying to attach multiple targets to a framebuffer object. I have the following problem: There is no error, when using float texture attachments and a depth attachment. There is also no error, when using float texture attachments and integer texture attachments. Although these combinations work, I cant use float,...

OpenGL : (graphic problems) vertical black lines appearing in all the screen

opengl,lines,graphic
I've recently got a blue screen error. I'm not sure if problems came after the blue screen, but I think that's important to notice it. Here is a gif of my problem : http://img110.xooimage.com/files/6/6/7/prob-4b77771.gif There are litle black lines appearing without reason (I never had this problem before). I think...

Weird crash at asigning a glm::vec3 constant reference to another glm::vec3

c++,opengl,glm
I'm having a ModelMatrix class in which i have a glm::vec3 defined as glm::vec3 *position = nullptr; Then i got a setter method void ModelMatrix::SetPosition(const glm::vec3 &position) { delete this->position; *this->position = position; } at asigning the constant reference the problem occurs. It goes inside this method template <typename T,...

Can't compile OpenGL project under OSX

c++,osx,opengl,osx-yosemite,glew
There's an OpenGL project I have to work on for a course I am attending. There were link errors due to GLEW. After some research, I found out that on OSX GLEW is not necessary. I included following headers. //#include "CL/cl_gl.h" #include <OpenGL/glu.h> #include <OpenGL/gl.h> //#include <OpenGL/glext.h> //#include <GLUT/glut.h> But...

GluPerspective acting strange

opengl,glut,scene,glu
I'm trying to change the field of view in my scene when touching F2 and F3. For this I have in my specialKey function this: void specialKey(int key, int x, int y) { switch (key) { case GLUT_KEY_F2: changeFOV = true; fovScale = 0.05; break; case GLUT_KEY_F3: changeFOV = true;...

Need to create a custom data 2D texture with reasonable precision

c++,opengl
The idea I need to create a 2D texture to be fed with resonably precise float values (I mean at least as precise as a glsl mediump float). I want to store in it each pixel's distance from the camera. I don't want the GL Zbuffer distance to near plane,...

OpenGL program works only in Debug mode in Visual Studio 2013

c++,opengl,visual-studio-2013,release
my small OpenGL application works fine in Debug mode, but if I build it in Release mode I often get this error: Shader Creation Error: - Vertex shader failed to compile with the following errors: ERROR: 0:22: error(#132) Syntax error: "]" parse error ERROR: error(#273) 1 compilation errors. No code...

Can I use both deprecated OpenGL and modern OpenGL in a single rendering window?

opengl,opentk
I am developing a project using modern OpenGL through OpenTK. I want to use Gwen dot net GUI library in my project. Unfortunately, Gwen dot net uses old OpenGL for its widget rendering. I have tried merging both modern OpenGL and Gwen dot net and so far, have been unsuccessfull....

Can linear filtering be used for an FBO blit of an MSAA texture to non-MSAA texture?

opengl,textures,framebuffer,blit,msaa
I have two 2D textures. The first, an MSAA texture, uses a target of GL_TEXTURE_2D_MULTISAMPLE. The second, non MSAA texture, uses a target of GL_TEXTURE_2D. According to OpenGL's spec on ARB_texture_multisample, only GL_NEAREST is a valid filtering option when the MSAA texture is being drawn to. In this case, both...

OpengGL face culing for selected faces

opengl
I'm importing geometry data from a file and the objects could be split in two categories: open or closed. If all of them were closed, I could just cull the backfaces, but since some of them are not closed, I cannot, because the user could see only the front faces....

OpenGL, Access violation

c++,opengl,access-violation
I am making an OpenGL project in Visual Studio 2010. I am following a tutorial from youtube. I don't know where the error is, and I have this error: Unhandled exception at 0x00000000 in OpenGL First Game.exe: 0xC0000005: Access violation. Main.cpp #include <GL/glew.h> #include <iostream> #include <GL/glut.h> #include "Sprite.h" Sprite...

freopen only prints one line when printf prints as much lines as i want (C++)

c++,opengl,2d
So i wanted to print a few lines of GL's Vertex2d coordinates into a file and i used this: { //namespace (for cout + cin) using namespace std; int p; //number of sides //body double r,d=3/4.0; cout << "input side count" <<endl; cin >> p; cout << "input radius" <<endl;...

How do I push and pop the matrix stack in LibGDX

java,opengl,libgdx
I'm having a hard time finding the equivalent of the very basic OpenGL functionality glPushMatrix and glPopMatrix in LibGDX. I have rendered my scene and I would like to render an overlay on top of the scene but I would like to do it in screen coordinates so I want...

OpenGL: Defining variables in shaders

opengl,glsl
My OpenGL program, using GLSL for shaders, has a simple vertex and fragment shader (given by a tutorial). The vertex shader is: #version 330 layout (location = 0) in vec3 Position; void main() { gl_Position = vec4(0.5 * Position.x, 0.5 * Position.y, Position.z, 1.0); } And the fragment shader is:...

How to get shader version from QOpenGLShader?

qt,opengl,glsl
I am using QT to load, compile and link OpenGL shaders. I need to perform specific operations depending on the GLSLversion used in the shader code Is it possible to recover the version from the QOpenGLShader interface without actually getting the shader source code and parsing it to detect the...

How to update the “forward” movement in OpenGL

c++,opengl,camera,fps
I have a problem with my OpenGL application that you can clearly see in this gif. Basically I would like to move in the direction pointed by the cursor, but this doesn't happen and instead the "forward" direction remains the same. For example if I turn 180° and press "w"...

OpenGL - translation stretches and distorts sprite

c++,opengl,transform,translation,distortion
I am loosely following the very handy tutorial at opengl-tutorial.org. I've been able to create a mesh, draw a sprite to it, and rotate and scale that mesh perfectly fine. However, I'm running into some issues when trying to translate the mesh. (pictures below) Here's an update function on the...

OpenGL ray casting (picking): account for object's transform

opengl,opentk,raycasting,mouse-picking
For picking objects, I've implemented a ray casting algorithm similar to what's described here. After converting the mouse click to a ray (with origin and direction) the next task is to intersect this ray with all triangles in the scene to determine hit points for each mesh. I have also...

What OpenGL loading library to use? [closed]

c++,opengl
Does anybody know an OpenGL loading library similar go GLEW that loads functions for OpenGL 2.0 but DOES NOT define them as macros?

Passing grayscale OpenCV image to an OpenGL texture

c++,opencv,opengl,glsl
I want to use a grayscale image generated in OpenCV in a GLSL shader. Based on the question on OpenCV image loading for OpenGL Texture, I've managed to come up with the code that passes RGB image to the shader: cv::Mat image; // ...acquire and process image somehow... //create and...

Qt OpenGL dynamic vs. desktop

qt,opengl
What is the difference between Qt versions with dynamic and desktop OpenGL? http://tver-soft.org/qt64

Optimizing OBJ file parser in c++

c++,parsing,opengl
I wrote an OBJ file parser in c++ and it works. It can load any OBJ file into a model. However it is incredibly slow. Loading one low-poly model can take up to ten seconds. Is there any way to optimize this or is my computer just extremeley low? Any...

Why are shaders and programs stored as integers in OpenGL?

c++,opengl,opengl-es,integer,shader
I'm following the "OpenGL Superbible" book and I can't help but notice that when we create a shader and create the program that we attach the shaders to, we store them as GLuint which are unsigned integers. Why are they stored as numbers? What does the value of the number...

OpenGL cube not being rendered

c++,opengl,3d
I'm struggling to get a cube to render in opengl. When I pass in the MVP already calculated to the vertex shader it works fine, but when I pass in the model, view and projection then do the calculation in the vertex shader it doesn't show the cube. I'm also...

How to draw on a single GLSceneViewer using GLCanvas but not on all viewers?

delphi,opengl,glscene
I'm usually using TGLCanvas on GLDirectOpenGL1Render to draw lines like this: uses GLCanvas, GLRenderContextInfo {...} procedure TForm1.GLDirectOpenGL1Render(Sender: TObject; var rci: TRenderContextInfo); var glc: TGLCanvas; begin glc:=TGLCanvas.Create(GLSceneViewerL.Width, GLSceneViewerL.Height); with glc do begin //Drawing lines here Line(0, 0, 10, 20); Line(10, 20, 30, 30); {...} end; glc.Free; end; But in current project...

Can the OpenGL 'deprecated' functions possibly be unsupported?

c++,c,opengl,graphics,deprecated
I am testing with glDrawPixels to port my simple pixel-drawn 2D game from Windows API to OpenGL with GLFW. It runs nicely with FPS over 100, additionally cross-platform. Just one thing that is slightly annoying me is that I'm using a deprecated feature. I don't see any problems now, but...

Rendering 2D Images best practices [closed]

c++,opengl,game-engine
I'm working on making a 2D game, and I've been looking through the tons of threads made regarding this - it seems to be a popular topic. The problem I am encountering, though, is that the advice differs each time, probably in part due to the fact that the questions...

OpenGL glTexImage2D memory issue

c,opengl
I'm loading a cubemap to create a skybox, everything is fine and the skybox renders properly with a correct texture application. However, I decided to check my program safety with valgrind, Valgrind gives this error: http://pastebin.com/seqmXjyx The line 53 in sky.c is: glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, texture.width, texture.height, 0,...

Best way to drag 3D point in 3D space with mouse picking in OpenGL?

c++,opengl,3d,drag-and-drop,mouse-picking
What is the best way to drag 3D point with mouse picking. Issue is not the picking but to dragging in 3D space. There are two ways I am thinking, one is to get the View to World coordinates using gluUnProject and translate the 3D point. The problem in this...

OpenGL fixed coordinate transformations

opengl,coordinate-systems,rotational-matrices
Was just trying to do some rendering with OpenGL and I happened to think about that: how would you run transformations in a fixed coordinate system. In other words, if you rotate an object around one axis you will see that the others are going to rotate too? Therefore, following...

Ruby, openGL : change texture luminosity

ruby,opengl,textures
I have some problems with OpenGL and luminosity. Let me explain you my problem : I drew this "sprite" (it's only a plane here) with a code like that : sprite.set_active left, right, top, bottom = 0.0, 1.0, 1.0, 0.0 glPushMatrix glTranslate(@position.x - 16, @position.y, @position.z) glRotate(-90 [email protected]_angle, 0, 1,...

OpenGL: Strange bahaviour of VBO deletion?

c++,opengl,vbo,opengl-3,vao
I am getting a strange issue in Vertex Buffer Object (VBO). I created a class that includes VBO creation and deletion. I delete all the VBOs (with glDeleteBuffers()) in the destructor of the class. Now I created 2 OpenGL context windows each running with VBO class. Now when I close...

Ambient and Specular lighting not working correctly in GLSL

opengl,glsl,lighting,phong
In my lighting scene, for some reason the ambient lighting isn't working at all. The whole model is the same brightness, no matter which way it is facing. I tried getting rid of the attenuation but it still has the same results. Along with that, the specular lighting is always...

Initializing a cubemap with existing 2D textures and glTextureView

c++,c,opengl
I am trying to create a cubemap from six existing textures. Texture views seem to be made for this sort of thing, also updating the cubemap when the original textures change. However, cubemaps can only be views of texture arrays (or other cubemaps) and i can't find any way to...

Matrix / vector multiplication order

opengl,math,matrix,vector
I've read a dozen articles online about the correct order of rotation, translation and scale matrix multiplication in OpenGL. However, now that I started implementing it myself, I came to the point where I'm really confused. Let's assume that in my code I'm calculating the transformation matrix, and I'm passing...

How can I render an infinite 2D grid in GLSL?

opengl,glsl
Ideally, what I'd like to do is draw a single quad and have GLSL handle the creation of the actual gridlines. In my attempt so far the vertex shader: #version 400 layout (location = 0) in vec4 in_position; layout (location = 2) in vec3 in_UV; uniform mat4 model; uniform mat4...

Should Meshes with and without Skeleton use different Shaders?

c++,opengl,glsl,shader,vertex-shader
Should Meshes with and without Skeleton use different Shaders? Background: Right now my shader is constructed to handle meshes with skeletons. Each vertex takes 3 bone IDs, with respective bone weight. This works well for models with skeletons that I wish to animate, but I feel that it is a...

Unable to render a texture on a quad

c++,opengl,textures,texturing
I am trying to program a simple game in C++ using OpenGL for graphics. In my game, I have objects that are rendered onscreen as a white square. I would like to be able to bind an image as a texture to these objects, so that I can render an...

The order of the linked libraries C++ linker

c++,opengl,opencl
I was debugging a project that depends on a set of libraries including libfreenect, OpenGL and OpenCL. The problem is that a black screen was the output. As a debugging option, I have removed the OpenCL code and the linked library completely trying to make sure that OpenGL works fine...

Need Minimum Textures required for OpenGL

opengl
Quick question, what is the minimum amount of textures that can be bound for the fragment shader that a OpenGL implementation is required to have? Note: I would like to know this for OpenGL 1.5, for OpenGL 2.0, and OpenGL 2.1...

Windows Gui and OpenGL relationship

user-interface,opengl,xlib
I have been studying lately OpenGL in university and searched on my own about Windows GUI programming in c++ like Qt. I even went deeper and found XLib for Windows GUI. But I still don't get the big picture. I understand that Qt is build on-top of XLib. And to...

Reading a shader from a .txt file using a structure

c++,opengl,struct,shader
I've started learning how to use OpenGL and I absolutely hate having my shaders declared as global variables before my main(). I thought it would be cool to make a structure or class that would read the shader from a file in my project directory. The file reading works perfectly...

What is the difference between glUseProgram() and glUseShaderProgram()?

c++,c,opengl,shader
In OpenGL what is the difference between glUseProgram() and glUseShaderProgram()? It seems in MESA and Nvidia provided glext.h, and in GLEW, both are defined, and both seem to do basically the same thing. I find documentation for glUseProgram() but not for glUseShaderProgram(). Are they truly interchangeable?...

“Capture GPU Frame” in XCode — iOS only?

xcode,performance,opengl,profiling
I am trying to profile a desktop OpenGL program with XCode. Neither instruments nor XCode's "capture GPU Frame" seem to be doing anything. Are these features iOS only and just not labeled as such? If so, what are the options for profiling OSX OpenGL programs?...

Can we MakeCurrent two opengl contexts in more than one thread simultaneously?

opengl
Can we use wglMakeCurrent function in more than one thread to use the same opengl context, simultaneously? or I have to create one opengl context per thread?

Java: FloatBuffer to OpenGL - wrap() vs. allocate() vs. BufferUtils.createBuffer()

java,opengl,buffer
Datasource: float[] v = { ... }; Working example: FloatBuffer buf = BufferUtils.createFloatBuffer(v.length); buf.put(v); buf.flip(); // or buf.rewind() The buffer can now be uploaded to opengl and works fine: ... glBufferData(..., buf, ...); ... Why do the following examples of the buffer creation not also work? Not working 1: FloatBuffer...

Migrating a Qt QGL based project to use OpenGL 4.3

c++,qt,opengl,opengl-es
Ever since I first started my current Qt project around 6 months ago, it has been using what I believe is version 1.3 of OpenGL. However as of recently, I've been itching to actually start improving the way I render things, and it appears that I'm missing many functions that...

wxWidgets with AUI: OpenGL render loop method and wxPaintEvent

c++,user-interface,opengl,wxwidgets
The method I traditionally use of drawing to an OpenGL canvas with wxWidgets is to trigger a 30 hertz timed refresh() from the current OpenGL canvas, which then generates a "wxEVT_PAINT", which I can propogate out to the rest of the frame. I also bind to the wxEVT_PAINT and call...

Creating GUI with OpenGL

java,opengl
I am trying to write a Java programm using LWJGL 3 and so far I've made it to creating a window, rendering to it and getting basic input. But I've ran into a problem with creating GUI and namely text fields that my programm requires. I found information that there...

Qt OpenGL transform feedback buffer functions missing

c++,qt,opengl,transform-feedback
I've been following a tutorial series for learning OpenGL, and the current tutorial I'm trying to do involves creating particle systems using the OpenGL transform feedback buffer. In my application I've been using Qt version 5.4.2 for simple 2D interface design, as well as for 3D rendering since it seems...

First OpenGL program from the Red book inside a Mac OS Cocoa NSOpenGLView

c++,objective-c,osx,cocoa,opengl
What I want to do is to simply run the first OpenGL program from the Red Book (triangles.cpp) inside a NSOpenGLView, but my app only clears the screen to black and does not draws the required triangles (even though the shaders were compiled successfully). (One side note: If I use...

OpenGL: Using glColorPointer make color weird

opengl
Like the picture showed in the link below. I want to color my robot hand with white color(RGB: 0.9 0.9 0.9). When I use glColor3f, the white color display correctly. But when I store RGB data in GLfloat array and call glColorPointer, the color becomes so weird. Here is code...

Switching from perspective orthographic projection in OpenGL

c#,opengl,opentk
I'm really new to OpenGL and trying to learn from the 'modern' OpenGL tutorials. I'm using C# and OpenTK. I'm setting my projectionMatrix with this code: _projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver3, GetAspectRatio(), 0.1f, 100f); After I set it, I upload it to the shaders, use for transformations, etc. Everything is working well...

Opengl - Is glDrawBuffers modification stored in a FBO? No?

opengl,state-machines,render-to-texture
I try to create a FrameBuffer with 2 textures attaching to it (Multi Render Targets). Then in every time step, both textures are cleared and painted, as following code. (Some part will be replaced as pseudo code to make it shorter.) Version 1 //beginning of the 1st time step initialize(framebufferID12)...

Difference between glewGetString(GLEW_VERSION) and glewIsSupported

c,opengl,glew
I created OpenGL context on Windows 7 machine as described on https://www.opengl.org/wiki/Creating_an_OpenGL_Context_(WGL) . Context was created successfully, but there seems to be some problems. Since I need vertex/fragment shaders, I need at least OpenGL version 2.0 (or some extensions). After context is initialized and glewInit is called, I checked OpenGL...

GLSL - program link error: Slot 0 unavailable from layout location request

c++,opengl,glsl
I'm trying to draw a textured quad copying some code from a tutorial but I'm afraid there is a problem with the shaders. Both the vertex shader and the fragment shader compilation works, but when linking the program I get the error: ERROR: Active attribute aliasing. Slot 0 unavailable for...

OpenCL / OpenGL Interop using GtkGLArea

c,opengl,gtk,opencl,gtk3
I know it looks like I only visit when I need something but I have another question. Building on my previous question, where I successfully ran a basic OpenGL program. I'm now adding OpenCL interop with a trivial CL script that shrinks the triangle a small amount each time it...

C++ Opengl - How to load tgas and pngs in modern OpenGL? [on hold]

image,opengl,c++11,png,tga
I am looking for a way to load tgas and pngs in C++ Opengl - I dislike the idea of using a library though. Is there any sample code / links / advice you could give me in this topic?...

Haskell - Could not deduce … from Context error - OpenGL AsUniform class type

class,haskell,opengl,types,uniform
I'm working on making my data types general instead of taking in the OpenGL type GLfloat. So I started making it take in type a and then just replacing everything with that. Now, I've come to a point where I'm setting uniform variables, but they take in GLfloat's. I'm using...

Changing texture parameters at runtime

c++,opengl
I am an OpenGL beginner and I have built a small engine for a universitary course. Now one constraint/feature I need to implement is to change the texture quality (interpolation) at runtime. So instead of e.g.: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); it should be changed to mipmaps glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) Now I...

Allocating a new buffer per each frame to prevent screen tearing

c++,c,opengl,graphics,sdl
When I use the SDL library to set the pixel values in the memory and update the screen, screen tearing occurs whenever the update is too fast. I don't know much about the SDL internals, but my understanding from what I see is that: The update function returns right after...

glclearcolor best color?

opengl,optimization
this might seam like a stupid question but i was wondering, when calling glClear(GL11.GL_COLOR_BUFFER_BIT); glClearColor(1, 0, 0, 1); to clear the screen in my opengl project is there any performance differences for using different colors? i mean if for example i clear to red vs blue/green/*insert any color will it...

LWJGL make object always face up

java,opengl,lwjgl
I need to make 3D objects to face up same way no matter their position to the camera. As if camera was very very far away and zoomed in. Here is what I mean (take a look at the pillar and walls): http://youtu.be/Pn9fh93oV-c Here is what I have so far:...

R32I sampler2D returns always 0

c++,opengl
I have a (default vertex and) fragment shader that should resize textures and scale their color by a specific factor for brightness correction. The result is rendered into an GL_UNSIGNED_INT_8_8_8_8 framebuffer. #version 330 uniform sampler2D tex; uniform vec2 screenSize; uniform float scale; layout(location = 0) out vec4 color; void main()...

Multitexturing theory with texture objects and samplers

opengl,textures
I couldn't find any good theory articles on how to code multitexturing with either only texture objects or texture objects plus samplers. I just don't know how to manage the glActiveTexture function and what it exactly does. glGenTextures(1, &texture); glActiveTexture(GL_TEXTURE0 + 0); // Number between 0 and GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS glBindTexture(GL_TEXTURE_2D, texture);...

Why normal mapping doesn't appear correctly?

opengl,jogl
I'm applying bump mapping to a tree. When no normal mapping applied, it appears like this. But when a normal texture is used, it turned out to be too aggressive as follow which is ugly. I checked tangent data which should be fine. So I was wondering if it's because...

OpenGL: How to get a pointer into video RAM for a texture's pixels?

opengl,video,ram
I would like to directly access the pixels of texture in video ram. Is this possible in OpenGL?

No OpenGL context is current in the current thread

java,opengl,lwjgl
I'm following a tutorial on youtube but I have a problem with OpenGL that I'm not able to solve. I have no idea how I can fix it. Exception in thread "EndlessRunner" java.lang.IllegalStateException: No OpenGL context is current in the current thread. at org.lwjgl.opengl.GLContextWindows.createFromCurrent(GLContextWindows.java:61) at org.lwjgl.opengl.GLContext.createFromCurrent(GLContext.java:36) at net.alfredo.Main.init(Main.java:59) at net.alfredo.Main.run(Main.java:91)...

OpenGL Texture rendering as black

objective-c,opengl,quartz-2d,syphon
I'm using the Syphon framework to try and push frames of video from a server to a client application. Syphon requires you to use OpenGL textures instead of normal images. Because of this, I'm trying to render a CGImageRef as a texture and send it on to be published. I'm...

Errors while compiling an OpenGL+OpenCL code on OS X

osx,opengl,opencl,glut
I am trying to compile an OpenGL+OpenCL code on my Mac and after a lot of efforts managed to get the dependencies installed and understood how to link them (GLUI, GLUT, OpenCL, etc). Most of the errors are removed but there are 3 errors that still persist as shown below:...

OpenGL How to use a invisible mask to hide objects behind it

opengl,opengl-es,depth,depth-buffer,stencils
I have an OpenGL problem to solve. I have an object/mesh A, an object/mesh B and a background texture C. Initially the framebuffer is filled with background texture C. We draw both A & B in the framebuffer. We want to keep object A visible, and object B always invisible....

glUniformMatrix4fv causing GL_INVALID_OPERATION

c++,opengl
When I call glUniformMatrix4fv or glUniform4fv in the below code it raises GL_INVALID_OPERATION every time, I have tried changing how I pass it the matrix data, the count I pass id, I've checked the model ids and shader program but can't figure out why it does it. Here is the...

My mesh is not rendering, but everything seems fine

opengl,libgdx
There is no log, no stack trace, just the Libgdx Mesh not rendering. I tested the Shader on a spriteBatch, and it works just fine. The mesh just does nothing with the render Method, not even a graphic bug... Do you have any idea what the issue could be? here...

GLFW3 create window returns null

c,opengl,struct,code-separation
I was trying to put all GLFW3 init code from main to separate file. When I'm running the code, I get EXC_BAD_ACCESS on glew init function, because GLFW could not create window. Before code separation everything was ok. Is it possible to have GLFW setup code in other function? I'm...

Opengl - instanced attributes

c++,opengl,geometry-instancing
I use oglplus - it's a c++ wrapper for OpenGL. I have a problem with defining instanced data for my particle renderer - positions work fine but something goes wrong when I want to instance a bunch of ints from the same VBO. I am going to skip some of...

Effect of rendering calls on performance

c++,opengl
Consider a situation , Case 1 : I am giving opengl calls to draw the world by drawing all polygons. So all polygons will be drawn according to all objects exist. (Considered all translation rotation). Case 2 : I will allow only polygons that are in field of view(FOV) of...

Need help finding out why the texture doesn't load

java,opengl
Trying to find a way to render a simple 2D image in Java using OpenGL I stumbled upon a more or less understandable class that does all of the image loading for you which I could not understand how to do. I believe it belongs to a person named Krythic...

Trying to load 2d texture with glTexImage2D, but just getting blank

c++,qt,opengl
I am trying to create a 2d texture to display on my Qt/OpenGL application. I then created a Quad that fills up screen to place it, but I all I ever get is a white screen without any errors. Does anyone see anything wrong with my code? #include "AppGLWidget.h" #include...

C++: vector size is wrong and higher than the number of elements

c++,opengl,vector
In my attempt to load .OBJ-files I load vertex data into std::vectors to send them to the GPU later. I fill three vectors, for normals, vertices and texture coordinates. The size of the normal vector is far higher than the size of the other two vectors, even if its filled...

Passing an int to a function, then using that int to create an array

c++,arrays,opengl
I'm trying to create a textureLoader class for my openGL project and I can't initialize an array of textures inside of my class constructor because the the array won't accept anything unless it's a const int. To paint you a simple picture... myFunction(NUM) { GLuint textures[NUM]; } My past Failures...

OpenGL stops rendering, possibly after an update

c++,opengl,glfw
I am working on a small OpenGL project using the GLFW library. Everything was fine until from one day, I can't get it to render anything except the background. So I loaded up an older version, which I am sure worked just fine and the same thing happens. I then...

glDeleteRenderbuffersEXT via remote desktop

windows,opengl,remote-desktop
I have an application that uses OpenGL. If I connect to a computer via Windows Remote Desktop I get an exception "Extension function glDeleteRenderbuffersEXT not supported" from my application. I think the exception is caused because Remote Desktop does not support the extension. My plan is to detect if the...

SSAO incorrect at z = 0 and at distance

opengl,rendering,deferred-rendering,ssao
So I tried to implement SSAO, but it is not working as intended. It seems to split at Position z=0 (worldspace), there is a white Line at position z=0. Also the Occlusion there doesn't look right. Plus at greater distance, so when moving the camera, the occlusion becomes even weirder...

How to run OpenGL version 3.3 (with Intel HD 4000) on Ubuntu 15.04

c++,opengl,ubuntu-15.04
Running the command glxinfo | grep OpenGL shows OpenGL vendor string: VMware, Inc. OpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE; OpenGL version string: 2.1 Mesa 10.7.0-devel OpenGL shading language version string: 1.20 OpenGL extensions: OpenGL ES profile version string: OpenGL ES 2.0 Mesa 10.7.0-devel OpenGL ES profile shading...

How to create latitudinal (horizontal) contour lines in GLSL?

opengl,glsl,webgl
I'm aiming for this effect: (horizontal-only contour lines): I did find this example, however it creates horizontal and vertical contour lines. I can't quite wrap my head around how the call to fwidth() is generating the lines. uniform float gsize;//size of the grid uniform float gwidth;//grid lines'width in pixels varying...

Water rendering in opengl [duplicate]

opengl,glsl,shader
This question already has an answer here: How to render ocean wave using opengl in 3D? [closed] 2 answers I have absolutely no idea how to render water sources (ocean, lake, etc). It's like every tutorial I come across assumes I have the basic knowledge in this subject, and...

How to access all vertexes within the same patch in Tessellation Control Shader

opengl,glsl,tessellation
I want to do LOD in Tessenllation Control Shader. And my method is to calculate the area each patch occupyed on screen coordinate, and set different tessellation level for them. So I need to access all vertices within a patch and I do so like: for(int i = 0; i...

rotating around objects

opengl,rotation,jogl,coordinate,orbit
I've been trying to make one object orbiting another: //childX,childY,childZ are my starting coordinates //here I count distance to the middle of my coordinate plane float r = (float) Math.sqrt(Math.pow(childX, 2)+Math.pow(childY, 2)+Math.pow(childZ,2)); //here i convert my angles to radians float alphaToRad = (float) Math.toRadians(findParent(figure.parentId).rotate[1]);//up_down float betaToRad = (float) Math.toRadians(findParent(figure.parentId).rotate[0]);//left_right float...

scale texture opengl 2

opengl,textures,scale
I have a rectangle in opengl 2 and I'm using a texture for it. It Works, but the texture is repeated over the rectangle, and what I want is to adapt to the size of the rectangle. I have read in this tutorial about the different parameters you can set...

Setting Up OpenGL in Qt for QOpenGLWidget

c++,qt,opengl,qt5
I have some old OpenGL code that I created with GLEW. I am trying to port this code into Qt 5.4, the old code contains Mesh, Shader, and Texture classes. What I have so far in Qt, is the default main window and a Visualizer class which inherits from QOpenGLWidget...

OpenGL4: Rotation looks all wrong

c++,opengl,glm-math
Here's the vertex buffer information of the quad I'm drawing: static const GLfloat pv_quad[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, }; This quad is used to draw 2D frames on the screen as part of the graphical user interface. The class I...

What happens after an openGL draw call?

c++,opengl
I'm trying to invert an image for a project, which should be as simple as scaling the projection matrix by (1, -1, 1). However, the screen is drawn inside an API that I have no access to and no documentation on (this project is VERY old). So performing that scaling...

Win32 Message Pump and std::thread Used to Create OpenGL Context and Render

multithreading,winapi,opengl,c++11
If I have a function that does the following: bool foo::init() { [Code that creates window] std::thread run(std::bind(&foo::run, this)); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } Where run is defined as: void foo::run() { [Code that creates initial opengl context] [Code that recreates window based on new...

OpenGL: try to draw lines using VBO(vertex buffer object), it doesn't display

c,opengl,vbo,vertex-buffer-objects
I try to switch my openGL code from using display list to using VBO. In the code, I tried to draw a green-grid floor, which is composed by green lines in parallel with x-axis and green lines in parallel with z-axis. But when the program runs, floor doesn't display. And...

OpenGL reading back buffer quickly

c++,opengl,hook
I'm trying to read the contents of the back-buffer into a buffer of my own. glReadPixels by itself is way too slow and drops my FPS from 50 to 30. So I decided to try the "asynchronous" read with a PBuffer but it crashes. My code is as follows: If...

Texture mapping consuming physical memory

c++,opengl,mapping,textures,glut
there's a problem with my texture mapping, when I execute the code, it run smoothly for 5-8 sec, then the framerate drop drastically, when I monitor the task manager, it seem the program consuming almost 95% of my physical memory, anybody know how to solve this problem?? I'm using visual...

glGetError and performance

c++,performance,opengl,opengl-es
Background At work, we develop two products which both have OpenGL 3.x+ and GLES 2.0/3.0+ backends. Teams are independent, but do have some overlap, and we were recently discussing performance of glGetError. In both products, the design is such that no GL calls should generate an error code recorded by...