Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 08 Mar 2012
Offline Last Active Oct 23 2014 04:21 PM

Topics I've Started

OpenGL 4 and Index Buffer

13 January 2014 - 06:52 AM



I'm following a tutorial about OpenGL 4 and the author always use glDrawArrays (with simple shape) but I'm wondering how he could draw complex shape without using any Index Buffer ?

Very strange problem

12 January 2014 - 07:49 AM



When I'm trying to execute my program, I get this error: "malloc: *** error for object 0x100d8b770: pointer being freed was not allocated". I used gdb to see the stacktrace:

#0  0x00007fff8c260866 in __pthread_kill ()
#1  0x00007fff8bcf135c in pthread_kill ()
#2  0x00007fff8c217bba in abort ()
#3  0x00007fff8b468093 in free ()
#4  0x0000000100001aae in Render::renderLoop ()
#5  0x0000000100001470 in RenderWindow::show ()
#6  0x0000000100000fab in main ()

The problem seems to come from the methode renderLoop() of the class Render. Here is the code of that method:

void Render::renderLoop(GLFWwindow* window) {
	Cube cube;

	float *points = cube.getArrayOfPoints();

	unsigned int vertexArrayObject = 0;
	glGenVertexArrays(1, &vertexArrayObject);

	unsigned int vertexBufferObject = 0;
	glGenBuffers(1, &vertexBufferObject);
	glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject);
	glBufferData(GL_ARRAY_BUFFER, cube.getSize() * 3 * sizeof(float), points, GL_STATIC_DRAW);

	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);


	// Vertex Shader
	std::string vertex_shader_file = readShaderFile("shader/test_vs.glsl");
	const char* vertex_shader = vertex_shader_file.c_str();

	// Fragment Shader
	std::string fragment_shader_file = readShaderFile("shader/test_fs.glsl");
	const char* fragment_shader = fragment_shader_file.c_str();

	unsigned int vs = glCreateShader(GL_VERTEX_SHADER);
	glShaderSource(vs, 1, &vertex_shader, NULL);
	unsigned int fs = glCreateShader (GL_FRAGMENT_SHADER);
	glShaderSource(fs, 1, &fragment_shader, NULL);

	unsigned int shader_programme = glCreateProgram();
	glAttachShader(shader_programme, fs);
	glAttachShader(shader_programme, vs);

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

	while (!glfwWindowShouldClose(window)) {
		// Wipe the drawing surface clear
		// Viewport
		glViewport(0, 0, getWindowWidth(), getWindowHeight());
		// Draw
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

		// Update other events like input handling 
		// Put the stuff we've been drawing onto the display

I don't see where my pointer points is being freed :/ Would you have any idea ?

Thanks in advance !

Trying to compile using C++11

11 January 2014 - 10:17 AM



I'm working on a small OpenGL project and I would like to use C++11 however when I'm trying to compile I get errors :/ Those errors aren't happening when I'm using C++98.

g++ -std=c++11 -Wall -I/opt/local/include -Iinclude src/main.cpp -o src/main.o
Undefined symbols for architecture x86_64:
  "RenderWindow::init(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int)", referenced from:
      _main in ccLk05Ex.o
  "RenderWindow::show()", referenced from:
      _main in ccLk05Ex.o
  "RenderWindow::shutdown()", referenced from:
      _main in ccLk05Ex.o
  "RenderWindow::instance_", referenced from:
      RenderWindow::getInstance()       in ccLk05Ex.o
  "RenderWindow::RenderWindow()", referenced from:
      RenderWindow::getInstance()       in ccLk05Ex.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [src/main.o] Error 1

The content of my main.cpp:

#include <iostream>

#include "renderwindow.h"

int main() {
    RenderWindow *renderWindow = RenderWindow::getInstance();
    renderWindow->init("OpenGL Framework", 640, 480);



My OS is Mac OS X 10.9 and I'm using GLEW, GLFW and GLM.


Would you have any idea why I got those errors ?


Thanks in advance !


D3D11CreateDevice failed

28 February 2013 - 08:36 AM



I have a huge problem. I can't run my program in Debug, I use the D3D11_CREATE_DEVICE_DEBUG when I want to initialize DX 11. However, it works in Release mode. I tried toreinstall the DirectX SDK but it's not successfull sad.png

Yesterday everything was working fine and not today sad.png


The source code that initialize DX 11:

UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)  
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;

D3D_FEATURE_LEVEL featureLevel;
HRESULT hr = D3D11CreateDevice(
		0,                 // default adapter
		0,                 // no software device
		0, 0,              // default feature level array

if( FAILED(hr) )
	MessageBox(0, L"D3D11CreateDevice Failed.", 0, 0);
	DXTrace( __FILE__, __LINE__, hr, DXGetErrorDescription(hr), FALSE );
	return false;

These are the information I get:

First-chance exception at 0x7751c41f in SpinningCube.exe: Microsoft C++ exception: _com_error at memory location 0x0031ec88..
An undetermined error occurred hr=E_FAIL (0x80004005)

Thanks in advance !

Is it a good idea to do a project like that?

14 January 2013 - 10:14 AM

Good afternoon everyone !
Last year I took an OpenGL course which was quite cool, the only problem is that we learned a very old way to program in OpenGL (we used GLUT). I had a project to do, a Pac-Man, in 2D and then in 3D. It was great, really, I liked it a lot ! The most interesting part was the graphics programming smile.png For my internship I looked for one in that domain but especially in the video game industry. Unfortunately, it's something very difficult (and rare) to find in Belgium. I finally did it in a company that are creating their own graphic engine on the top of OGRE. I didn't worked on the engine itself but on a tool, a plugin for Autodesk Revit Architecture. I had to integrate OGRE for a real-time preview of the opened file in Revit. It was quite a challenge, not because of OGRE but because of the Revit API which is awful and absolutely not thought for doing that.
Well that's it for the past smile.png
Few month ago I purchased the book "Introduction to game programming with DirectX 11" by Frank D. Luna and I'm reading it. It's very well written and understandable. I had an idea project to do while learning DirectX 11, some kind of a demo application that shows what I implemented (e.g. generating sphere, loading mesh, generate terrain...). I would like to know what you think of that, if you have any advice to give me or anything else that can help me.
Thanks in advance !