Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Yours3!f

Member Since 04 Feb 2011
Offline Last Active Today, 03:27 AM
-----

#4913038 Posssible memory leak in OpenGL Intel Win7 drivers

Posted by Yours3!f on 14 February 2012 - 11:35 AM

void mapAndCopyToBuffer(char* img1)
{
		glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pixelbufferHandle);
		mappedBuf = (char*) glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
		memcpy(mappedBuf, img1, w * h * s);
		glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
		mappedBuf = NULL;

		glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelbufferHandle);

		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
}

seems like you don't free your mappedBuf after using it. you need to do this if you want to really free some memory:

void mapAndCopyToBuffer(char* img1)
{
		glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pixelbufferHandle);
		mappedBuf = (char*) glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
		memcpy(mappedBuf, img1, w * h * s);
		glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
		delete [] mappedBuf; //this is what you need, see explanation below
		mappedBuf = NULL;

		glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelbufferHandle);

		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
}



this indicates you're not completely aware of how to use pointers.

to clear things up:

int* pointer = 0; // creates an 8-byte pointer to an integer, pointer's value is 0 (Null-pointer) EDIT: yep it was unintialized...
int value = *pointer; // ERROR: you tried to access the contents of a null-pointer, this is illegal
pointer = new int; // dynamically (at runtime) assigns 4 bytes of memory at the place which is pointed by pointer, pointer is now valid
int value_2 = *pointer; // VALID: pointer actually points to somewhere, so value_2 should be either 0 or a random number, this depends on the compiler
delete pointer; // tells the operating system to free the place pointed by pointer
int value_3 = *pointer; // VALID: pointer still points to somewhere in the memory, and most probably you'll get back the old value pointed by pointer, since nothing has overwritten it. BUT this cannot be guaranteed (so DO NOT do this)
pointer = 0; // now pointer is a null-pointer again, but this doesn't free up any space, as opposed to delete
int value_4 = *pointer; //ERROR: you tried to access a null pointer again.
// for arrays you need to use this:
pointer = new int[32]; // allocate 32 integers (4 bytes per int) to the place pointed by pointer
//pointer will actually point to the first element of the array meaning this will be valid, and give a value:
int value_5 = *pointer; // VALID: gives back pointer[0]
delete [] pointer; //this frees up the space pointed by pointer, but pointer will still be valid, so you need to set it to 0
pointer = 0; // now pointer is a null-pointer again
// to check wether pointer is valid you can use a simple if
if(pointer) // if pointer is 0 (logical false) it will be invalid (null-pointer) else it will be valid
{
  std::cout << "Pointer is valid.\n";
}
else
{
  std::cout << "Pointer is INvalid.\n";
}

oh and please write back if this solved your problem.

best regards,
Yours3!f


#4906116 need help with rotation, transformation and scaling in opengl mathematics

Posted by Yours3!f on 25 January 2012 - 09:02 AM

so if i don't use shaders i can't do translation, rotation or scaling?
what is sharder? what is the use of them?

sorry for the newbie questions.


ummm... shaders aren't responsible for translation rotation etc. but rendering. Math libraries are supposed to handle this stuff. You can find many math libraries that replace the built-in opengl maths.
To mention a few: GLM, CML, Eigen, libmymath
A shader is a tiny program that runs on your video card. It supposed to replace the fixed pipeline rendering that you used in OGL 2.1.
It has many advantages over the old rendering one being the great flexibility it offers when it comes to rendering.


#4897754 WebGL and Javascript...

Posted by Yours3!f on 29 December 2011 - 05:25 AM


"Framebuffer: COLOR_ATTACHMENT0 exists on specification but COLOR_ATTACHMENT1 is not..."

So, is this means that mrt (Multiple Render Targets) is not supported?


Also, looks like it doesn't support depth/stencil textures. Is it true?

Best wishes, FXACE.


as far as I know in both OpenGL ES and WebGL MRT is not supported by the specification.

according to this:
OpenGL ES 2.0 §4.4.3

(as suggested on the WebGL specification page under the FramebufferRenderbuffer function)

color attachments other than the 0th are NOT supported. So you have to do multipass rendering if you still want to use this functionality.

according to this:
OpenGL ES 2.0 §3.7.1

you can only create (with TexImage2D) RGBA, ALPHA, and LUMINANCE textures, so depth and stencil texture creation isn't supported. You can only create FBOs with these (depth, stencil) attachments (and I think renderbuffers too), but still the attached textures can't have the hardware supported GL_DEPTH_COMPONENT as internal format.

according to this:
OpenGL ES 2.0 §3.7.13

you can use
void deleteTexture(WebGLTexture texture)
for deleting textures.

here's the online specification:
https://www.khronos.org/registry/webgl/specs/1.0

you can see that in a lot of places it refers to the OGL ES specification, but if you're concerned about the differences just look them up in the table of contents.

I tried to be as precise as I could, but if I'm wrong correct me :)


#4885974 FBO texture is empty / black

Posted by Yours3!f on 20 November 2011 - 03:15 PM

why do you unbind your RBO? don't you need it?

why do you set the viewport and perspective matrix settings when rendering to the FBO? Shouldn't you set it before any rendering?

are you sure you want to use mipmapping? + you don't generate any mipmaps...
glGenerateMipmap(GL_TEXTURE_2D); perhaps

can't think of any other stupid mistake I'd make :)


#4861191 How long until c++ disapear from game development

Posted by Yours3!f on 13 September 2011 - 12:12 PM

I hope it will never-ever because its the only language I'm good at :)

to take it seriously I think because someone can't handle c++ (and uses c# etc.) doesn't mean that it should be avoided. It only means that c# is good for learning programming and c++ is for hardcore, performance-aware programmers.


#4840075 [discussion]DirectX 9 or 10 or 11?

Posted by Yours3!f on 25 July 2011 - 11:24 AM

(no flame intended)

why don't you use opengl?
It'd run on windows xp vista & 7 (and on other platforms as well) you'd get full dx10 level features with that graphics card until you get a dx11 level card, and the transition would be seamless. You wouldn't have to worry about whether you're on XP or Vista or 7 you'd get the same visuals and same features... Plus, as I recently experienced, the two API are like twins (or at least DX 9 and OpenGL 2.1), the same features, same workflow, etc. Although I felt like dx was harder to learn due to the lack of good tutorials.


#4833695 DX11 D3D_FEATURE_LEVEL_9_3 and Win XP

Posted by Yours3!f on 11 July 2011 - 06:26 AM

use OpenGL to access DirectX 11 level features (OpenGL 4.x) under WinXP :D


#4829759 intel vga driver (8.15) fails to compile the shaders

Posted by Yours3!f on 30 June 2011 - 02:36 PM

isnt theuniform sampler2d name a basic glsl feature?
lol you almost had me :)
if i had the source code...


#4826511 xbox360 development

Posted by Yours3!f on 22 June 2011 - 11:18 AM

thanks for the replies, so I guess xna && c# is the way to go... damn you microsoft :)


#4823517 GLSL Compilation error

Posted by Yours3!f on 15 June 2011 - 01:52 AM

Ok guys I fixed it. My problem was with loading the files.


that would've been my 2nd guess :)


#4816993 help me to finde the track in opengl game industry

Posted by Yours3!f on 28 May 2011 - 11:30 PM

<br />VC++ is the only choice.<br />There use to be Borland which got renamed to Inprise but they seemed to have disappeared (no one talks about them). <a href='http://www.borland.com' class='bbc_url' title='External link' rel='nofollow external'>http://www.borland.com</a><br /><br />All the rest : Eclipse, Develop Builder, Devcpp, codeblocks, gcc, are amateurish.<br />

<br /><br /><br />

I don't agree, I've been using kdevelop for years, and so far I think it is the best IDE (I use VC as well). To add, Qt creator is also a great IDE, it has I think the best user interface ever. I don't think Eclipse is amateurish, because when it comes to Android development it is simply the best choice (even Google advises the usage of it).
There are many great IDEs, and it is only up to you which will you find the best. So my advice is to try out every one of them, and decide which was the best and stick to it. Don't give it up at the first try, because for example to use kdevelop I had to learn how to write cmake makefiles, which isn't the easiest thing, but I did manage.


#4814159 Is there a need for another modern OpenGL guide?

Posted by Yours3!f on 22 May 2011 - 02:54 AM

I'm  thinking of writing a modern OpenGL guide. I realize that more and more  modern OpenGL guides are popping up, but I think there are still things  that most (if not all) of them lack:

  • A site that can be corrected and updated by users, e.g. a wiki.
  • Information for setting up your context in every language and platform (C++, C#, WebGL, Android, ...).
  • Bare-bones interaction, not letting libraries do everything for you. At least not in the beginning.
  • Beats NeHe's tutorials in Google's search results (I've registered http://open.gl for this exact purpose).
  • Including everything in one place. The current situation makes modern OpenGL too hard to learn
I think that's great that you collected what other sites lack, and hats off to your enthusiasm. The question is can you make a tutorial site that can match the other sites, and correct these things you listed?


Personally I wouldn't care how deep you understand OpenGL, because as far as you don't write bulls..., and as far as it works I think anyone can write one.
I think noone can understand OpenGL as deeply as the people who created it, or belong to any of the categories Yann L listed, and for an "everyday guy" it is impossible to become one of them.
And I don't think those guys have time to write such sites.

I think these sites also lack the ability to present the concepts of developing an OpenGL based GAME ENGINE. I mean I don't really like to write samples all the time. So in that sense your site could be far better than the present ones.

So I do think there's a need, but only if you can meet those requirements you listed (and match the other sites).



#4813032 ssao_crytek

Posted by Yours3!f on 19 May 2011 - 09:31 AM

I dont know if you remember, but when this year Crysis 2 was about to hit the shelves, someone (probably a Russian) stole an early build of the game. Now what's interesting is that it contained the shader source codes.
I haven't seen the source code, but it might be interesting and might help you with what you're missing. Note that it will probably be written in DX HLSL language.


#4798852 OpenGL in 10 days !?!?!

Posted by Yours3!f on 15 April 2011 - 12:08 PM

its not going to be 10 days but rather at least a year:) (or more, from personal experience)
you might read the bible 5th edition in a month or so, but that's unlikely and even after reading you'll have to practice a LOT until you get comfortable with it and deal with your own ideas.
even after doing the aforementioned practice you'll likely run into lot of problems, that usually will come from not being experienced enough.
to add, if you aren't comfortable with C++ than it will likely take much longer time to accomplish this.

I'm not trying to persuade about don't start to learn OpenGL, but I'd like to emphasise that it will take a long-long time to get to the end of it




PARTNERS